To get the most out of this book
This book uses the Xcode IDE version 10 (Swift 4.2). If you use a different version of Xcode, you will likely encounter syntax differences; Apple is constantly upgrading Swift's syntax. You can use Xcode's Edit | Convert | To Current Swift Syntax to update the code examples in this book to a newer version of Xcode.
Visit https://developer.apple.com/xcode/to download Xcode.
You will need an Apple developer account to integrate your apps with Game Center and submit your games to the App Store.
To run ARKit games you will need an iPhone SE or higher, a fifth-generation iPad, or an iPad Pro. To run the Multipeer AR project you will need two devices because it can't be tested on an emulator.
Download the example code files
You can download the example code files for this book from your account at http://www.packt.com. If you purchased this book elsewhere, you can visit http://www.packt.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
- Log in or register at http://www.packt.com.
- Select the SUPPORT tab.
- Click on Code Downloads & Errata.
- Enter the name of the book in the Search box and follow the on-screen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR / 7-Zip for Windows
- Zipeg / iZip / UnRarX for Mac
- 7-Zip / PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Swift-Game-Development-Third-Edition. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Conventions used
There are a number of text conventions used throughout this book.
CodeInText
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. For example; "Locate the Enemies
folder in the downloadable asset bundle."
A block of code is set as follows:
import SpriteKit class Coin: SKSpriteNode, GameSprite { var initialSize = CGSize(width: 26, height: 26) var textureAtlas: SKTextureAtlas = SKTextureAtlas(named: "Environment") var value = 1
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
import SpriteKit import ARKit class Scene: SKScene { var crosshair: SKSpriteNode! let scoreText = SKLabelNode(text: "00")
Bold: Indicates a new term, an important word, or words that you see on the screen, for example, in menus or dialog boxes, also appear in the text like this. For example: "Select System info from the Administration panel."
Note
Warnings or important notes appear in a box like this.
Tip
Tips and tricks appear like this.