This is one of the last games you'll be making with UIKit; almost every game after this one will use Apple's SpriteKit library for high-performance 2D drawing. To make this last UIKit effort count, we're going to have a fairly complicated user interface so you can go out with a bang. We're also going to mix in some great new Swift techniques, including property observers, searching through arrays, modulo, array enumeration, ranges and more!
Of course, you're probably wondering what kind of game we're going to make, and I have some bad news for you: it's another word game. But there's good news too: it's a pretty darn awesome word game, based on the popular indie game 7 Little Words. This will also be our first game exclusively targeting iPad, and you'll soon see why – we're using a lot of space in our user interface!
So, go ahead and create a new Single View App project in Xcode, then save it somewhere. Now go to the project editor and change its device from Universal to iPad, then deselect Portrait and Upside Down orientations.
What's that? You don't know where the project editor is? I'm sure I told you to remember where the project editor was! OK, here's how to find it, one last time, quoted from project 6:
Press Cmd+1 to show the project navigator on the left of your Xcode window, select your project (it's the first item in the pane), then to the right of where you just clicked will appear another pane showing "PROJECT" and "TARGETS", along with some more information in the center. The left pane can be hidden by clicking the disclosure button in the top-left of the project editor, but hiding it will only make things harder to find, so please make sure it's visible!
This view is called the project editor, and contains a huge number of options that affect the way your app works. You'll be using this a lot in the future, so remember how to get here! Select Project 6 under TARGETS, then choose the General tab, and scroll down until you see four checkboxes called Device Orientation. You can select only the ones you want to support.
Obviously now that we’re in project 8, you should look for Project 8 under “TARGETS”, otherwise all that still applies.
Important warning: There are a number of iPad types available when choosing your simulator. I suggest you choose iPad Air – it’s a high-spec device and certainly won’t run quickly, but it’s much better than the 12.9-inch iPad Pro! Go to the Product menu and choose Destination > iPad Air to change this setting.
Learn Server-Side Swift now!
Take your Swift code to the server and become a full-stack developer with my latest book: Server-Side Swift!