Kodeco Forums

Video Tutorial: Beginning Core Graphics Part 5: PaintCode

Learn about PaintCode 2. We’ll draw an icon in PaintCode 2 and also use expressions to dynamically control the icon's color.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/3402-beginning-core-graphics/lessons/6

Nicely done Caroline. Very helpful and informative PaintCode tutorial. This is a huge time saver for icon creation.

1 Like

Hello,
is there a way to get paint coded on discounted price?

Hi dehrab - we don’t supply PaintCode. You can only purchase it from here directly:

http://www.paintcodeapp.com or from the Mac App Store:

https://itunes.apple.com/au/app/paintcode-2/id808809998?mt=12

Hi thanks for the great tutorial. As I was following the PaintCode episode, I encountered two problems (related to the 11:00 part of the video). Here’s the first one:

I assume that my error appears because PaintCode’s codes are not ready for Swift 3, Xcode 8.0 on macOS Sierra v10.12 (which I am using). Would you have any suggestion on how I can fix the problem?

Attaching the screen shot of the second problem…

Unfortunately Swift 3 broke a large number of things, and you’re very brave to be tackling this in Swift 3.

It’s not obvious why your first one shows an error. You could try replacing all uses of public class in Icons.swift to open class. But I’m not hopeful.

Your second problem is a Swift annoyance where the expression needs to be broken up. Something like:

    //// Group
    //// Wheel 1 Drawing
    var x = group.minX + floor(group.width * 0.11934 - 0.04) + 0.54
    var y = group.minY + floor(group.height * 0.71795) + 0.5
    var width = floor(group.width * 0.35231 - 0.04) - floor(group.width * 0.11934 - 0.04)
    var height = floor(group.height * 0.99829) - floor(group.height * 0.71795)
    let wheel1Path = UIBezierPath(ovalIn: CGRect(x: x, y: y, width: width, height: height))

If your first problem isn’t fixed, I would suggest taking the provided final project and converting it to Swift 3. This is really easy if you do the following.

If you open the downloaded project and straight away blithely convert it to Swift 3, you will probably get a mountain of errors.

However, open the untouched downloaded project, and when it asks you to convert, click Later twice. Now change your team signing in General settings from None to your team. Quit Xcode.

This time when you open the project, click Convert and then Convert to Swift 3 and Next and Next. Xcode will generate a preview. Save this. Everything should be converted properly and you can compare your code to the new Swift 3 code.

You will still get your second error which you can fix as I suggested above.

I don’t know why the project takes such a long time to build.

1 Like

It seems to work now. Thanks so much!