BLACK FRIDAY: Save 50% on my Swift books and videos! >>

< Previous: Overview   Next: Basics quick start: SKShapeNode >

Setting up

I don't want to put you off, but this is by far the longest project in the series. It's not the most complicated, but it's long, coming in just short of 500 lines in total. That said, I hope it'll be worth it, because the end result is great: we're going to make a Fruit Ninja-style game, where slicing penguins is good and slicing bombs is bad. I think I must unconsciously have something against penguins…

Anyway, in this project you're going to be creating your own enums for the first time, you're going to meet SKShapeNode and AVAudioPlayer, you're going to create SKAction groups, you're going to create shapes with UIBezierPath, learn about default parameters, and more. So, it's the usual recipe: make something cool, and learn at the same time.

This is the second of two projects that are hard – not because I'm trying to set you back, just because they are more complex than the others. This project is hard because you need to write a lot of code before you can start to see results, which I personally find frustrating. I much prefer it when I can write a few lines, see the result, write a few lines more, see the result again, and so on. That isn't possible here, so I suggest you make some coffee before you begin.

Still here? OK!

Create a new SpriteKit project in Xcode, name it Project17, then do the usual cleaning job to create a completely empty SpriteKit project: remove all the code from didMove(to:) and touchesBegan(), change the anchor point and size of GameScene.sks, and so on – if you don’t remember all the steps, just look back to project 14 or 11.

You should also download the files for this project from GitHub (, then copy its Content folder into your Xcode project.

Please force the app to run only on landscape iPads before continuing.

Reminder: Don’t forget to use a real device for this project, or, if you must, the lowest-spec iPad in the simulator.

Test your Swift today

Think you know Swift? My book Swift Coding Challenges will put your Swift skills to the test – it's perfect for job interviews and more!

< Previous: Overview   Next: Basics quick start: SKShapeNode >
Buy Testing Swift Buy Practical iOS 12 Buy Pro Swift Buy Swift Design Patterns Buy Swift Coding Challenges Buy Server-Side Swift (Vapor Edition) Buy Server-Side Swift (Kitura Edition) Buy Hacking with macOS Buy Advanced iOS Volume One Buy Advanced iOS Volume Two Buy Hacking with watchOS Buy Hacking with tvOS Buy Hacking with Swift Buy Dive Into SpriteKit Buy Swift in Sixty Seconds Buy Objective-C for Swift Developers Buy Beyond Code

Was this page useful? Let me know!

Click here to visit the Hacking with Swift store >>