Today you will begin putting the pieces together for a brand new game – see what we did there? To many, Swiftris resembles not only in name but in nearly every other respect a game written in the early 1980s that to this day continues to be played all around the world. Rest assured, Bloc is absolutely certain that any semblance to said game is merely coincidental.

In all seriousness, this is a Tetris clone written in Swift for the iOS platform. This Bloc Book is meant for educational purposes only and we do not recommend releasing your version of Swiftris to the App Store. If you do release Swiftris anyway, hope that you never cross paths with Alexey Pajitnov. As you can see, he's a very dangerous man.

Alexey Pajitnov

Before we start playing with blocks, you should know the tools we'll be using: Swift, SpriteKit and Xcode.


Swift is Apple's latest programming language. In time it will replace Objective-C as the primary language in which iPhone and Macintosh applications are written. Swiftris is written entirely in Swift and this book will present a wide variety of the language's capabilities.

If you are not a programmer, do not worry. Regardless of skill level, you will have your very own copy of Swiftris after completing this guide. However, this book does not intend to teach you the language in its entirety. Several aspects of it will be covered in brief and supplemented by external resources.


SpriteKit is a set of APIs provided by the iOS SDK (software development kit) which allow native 2D game development from within Xcode. Swiftris is powered by SpriteKit and therefore no additional libraries or 3rd party tools will be required to build this great game.


Xcode 6 is required for Swift development, download Xcode 6.1.1 before continuing.

While it's not required for this book, you may want to consider signing up for the iOS Developer Program. We think the $99 annual fee is wholly worthwhile: it provides access to yet-to-be public software updates and allows you to publish apps to your iPhone and the App Store.

Once you have Xcode downloaded and installed, you are ready to move to the next chapter.

Swiftris was written exclusively for Xcode 6.1.1. Attempting to follow this tutorial with any version of Xcode other than 6.1.1 is likely to result in syntax or interface errors.