NEW: Master Swift design patterns with my latest book! >>

< Previous: Property observers: didSet   Next: Project 9 >

Wrap up

Yes, it took quite a lot of storyboard work to get this project going, but I hope it has shown you that you can make some great games using just the UIKit tools you already know.

Of course, at the same time as making another game, you've made several steps forward in your iOS development quest, this time learning about addTarget(), enumerated(), index(of:), joined(), replacingOccurrences(), property observers, and range operators.

Looking at that list, it should be clear that you are increasingly dealing with specific bits of code (i.e., functions like index(of:)) when you're developing UIKit projects. This is because you're starting to build up a great repertoire of code, so there is simply less to teach. That's not to say there aren’t a lot of new things still to come – in fact, the next few projects all introduce several big new things – but it does mean your knowledge is starting to mature.

If you're looking to improve this project, see if you can make it deduct points if the player makes an incorrect guess - this is just a matter of extending the submitTapped() method so that if index(of:) failed to find the guess then you remove points.

For a harder challenge, think about what Auto Layout constraints might be needed to make this game work well on larger iPads. One smart solution would be to place all the letter buttons inside a single container view – that would allow you to keep the buttons the same size and adjust the position of the container across iPad sizes.

You did it! Now what?

You finished another project, and I'm glad Hacking with Swift helped you. Now I need your help. Please take just a moment out of your day to tell others about Hacking with Swift so they can benefit too.

You can click below to post a tweet straight to this project. Or if you're feeling particularly generous, you can click here to link to Hacking with Swift on your website and help spread the word.

Thank you. Your support is what keeps me going!

 

About the author

Paul Hudson is the creator of Hacking with Swift, the most comprehensive series of Swift books in the world. He's also the editor of Swift Developer News, the maintainer of the Swift Knowledge Base, and Mario Kart world champion. OK, so that last part isn't true. If you're curious you can learn more here.

Upgrade to premium

The Hacking with Swift guide book helps you learn faster, plus get an Xcode tips and tricks video and Swift wall chart.

< Previous: Property observers: didSet   Next: Project 9 >
Click here to visit the Hacking with Swift store >>