O'Reilly logo

Learning iOS 8 Game Development Using Swift by Siddharth Shekar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The basic Metal project

In this first project, we will create a basic triangle and display it on the device.

Create a new Xcode project. Select Metal as the technology and Swift as the language for the project:

The basic Metal project

Select a location to save the project in. In the GameViewController.swift file, we delete all the contents of the viewDidLoad functions, so that we can start from the absolute basics.

As discussed in the overview, the first thing that we have to do is get the device that the application will work on. Add the following line:

//get device
let device: MTLDevice = MTLCreateSystemDefaultDevice()

We create a new constant called device of the MTLDevice ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required