Examining the demo code

Let's quickly explore the demo code. Do not worry about understanding everything just yet; we will cover each element in depth later. At this point, I am hoping you will acclimatize to the development environment and pick up a few things along the way. If you are stuck, keep going! Things will actually get simpler in the next chapter, once we clear away the SpriteKit demo and start on our own game.

Make sure you have GameScene.swift open in Xcode.

The demo GameScene class implements some functions you will use in your games. Let's examine these functions. Feel free to read the code inside each function, but I do not expect you to understand the specific code just yet:

  • The game invokes the didMove function whenever it switches ...

Get Swift Game Development - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.