Kodeco Forums

Core Graphics Tutorial Part 3: Patterns and Playgrounds

Finish your exploration of Core Graphics by learning how to draw a repeatable pattern and using Playgrounds to prototype drawing a complex image.


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/1973-core-graphics-tutorial-part-3-patterns-and-playgrounds

Hello Caroline,

Your tutorial is very helpfull for this just started App-composer.

Now I feel a bit stupid as in my MedalDrawing-playground I never see this image showing up at the place where it ought to be.
( //This code must always be at the end of the playground )

To find out why, I downloaded your version and there I shows up indeed. Why not in my version? I can’t find the difference between yours and mine.
Is this maybe dependent of a general setting in the playground preferences? I can’t find this.


In meantime I found the reason: you have to click at given lines this symbol
And this is indeed also mentioned in explanation. I’ve overseen this. Sorry for that.
Great way to explore and try out with playgrounds.

Very glad you found the answer :). Playgrounds are the best!

Great tutorials. This was a excellent series. Well explained and presents lots of useful info. Thanks!

1 Like

Hello Caroline,

Your tutorial is very GOOD!

But I found a tiny error when code it:

When copy the medaldrawing code from Playground as you write, a alert will occur – " Use of instance member ‘creatMedalImage’ on type ‘MedalView’; did you mean to use a value of type ‘MedalView’ instead?" at [ lazy var medalImage:UIImage = self.createMedalImage( ) ]

Maybe it should use closure directly after the variant, just like : lazy var medalImage: UIImage = { // the whole draw code}( )

@christiansong - it seems to work for me. I just tried in Xcode 7.3, and didn’t get that error. Are you converting to Swift 3 or using Xcode 8?

Perhaps you could download the final code sample and compare it with yours?

Hi @caroline are there updates to Swift 3 and Xcode 8 for this Tutorial?

Great work btw! Thanks for putting this together.

@therealcanadian - sorry I didn’t see a notification.

No, sorry - there currently isn’t a Swift 3 version. I’m not sure what’s in the pipeline

1 Like

I’m assuming you’ve figured it out by now, but if not - or if anyone else wants a Swift 3 version, I’ve updated the final project. It’s available here: GitHub - swillsea/Flo_Swift3: Flo tutorial converted to Swift 3. Original: https://www.raywenderlich.com/90690/modern-core-graphics-with-swift-part-1

2 Likes

transform = transform.translatedBy(x: 15, y: 30), this x translate 15 and y translate 30 , how to calculate ?

@tzsh I think I probably used trial and error to get these values.