PixelCut has announced that support for Swift 2.3 and Swift 3 is coming this month. PaintCode currently doesn't support Swift 2.3 and Swift 3. Open CoffeeView.swift and paste the code you copied from PaintCode into the draw(_:) method. Name the subclass CoffeeView and make sure to set Language to Swift. Set the source code editor at the bottom to iOS > Swift, copy the code, and fire up Xcode.Ĭreate a new project based on the Single View Application template and create a UIView subclass. I am not a great designer, which is why I use third party icons that I convert to code. If you want, you can use it to create the assets for your application. PaintCode is a powerful drawing application. The generated code to draw the shape is visible at the bottom. Drag and drop the SVG image onto the canvas.īecause we imported an SVG image, the components of the shape are shown in the inspector on the right. Open PaintCode and create a new document by choosing New from the File menu. I am going to show you how to convert an SVG image into a drawable shape. You can download a free trial of PaintCode from the PixelCut website. This makes it very easy to import icons into PaintCode and turn them into code. The most recent editions of Glyphish also include an SVG version of each icon. Glyphish has been around for many years and I frequently use Joseph Wain's icons. This means that assets drawn in code are automatically future-proof. And a shape drawn in code looks great on any device, regardless of the screen's resolution. You don't need to include images at various resolutions in the bundle of your application. Last but not least, the size of the application bundle decreases quite a bit. Changing the color or the size of an icon is no rocket science. It is easy to make changes to icons that are drawn in code. Why would you want to draw shapes in code? Why is that better than using images? Depending on the complexity of the shape, drawing shapes in code is mostly faster than loading the image from the application bundle and drawing it onto the screen.Īnother benefit is flexibility. In this tutorial, I show you how easy it is to import an SVG ( Scalable Vector Graphics) image into PaintCode and export it as code, ready to use in your application. The buttons in Samsara, for example, shown in the screenshot below, are drawn in code using PaintCode. I have been using PaintCode for several years and it has saved me countless hours and a lot of frustration. PaintCode is a great macOS application for drawing shapes and converting them to code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |