


#Paintcode tutorial code#
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.
#Paintcode tutorial how to#
I am going to show you how to convert an SVG image into a drawable shape.
#Paintcode tutorial trial#
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. I don’t know why the project takes such a long time to build.PaintCode is a great macOS application for drawing shapes and converting them to code. You will still get your second error which you can fix as I suggested above. Everything should be converted properly and you can compare your code to the new Swift 3 code. This time when you open the project, click Convert and then Convert to Swift 3 and Next and Next. Now change your team signing in General settings from None to your team. However, open the untouched downloaded project, and when it asks you to convert, click Later twice. If you open the downloaded project and straight away blithely convert it to Swift 3, you will probably get a mountain of errors. This is really easy if you do the following. If your first problem isn’t fixed, I would suggest taking the provided final project and converting it to Swift 3. Let wheel1Path = UIBezierPath(ovalIn: CGRect(x: x, y: y, width: width, height: height)) Your second problem is a Swift annoyance where the expression needs to be broken up. You could try replacing all uses of public class in Icons.swift to open class. It’s not obvious why your first one shows an error. Unfortunately Swift 3 broke a large number of things, and you’re very brave to be tackling this in Swift 3.
