Working with object-oriented code in iOS apps
So far, we have created and extended classes in the Playground. In fact, we could execute the same sample code in the Swift REPL and the web-based Swift sandbox.
Now, we will create a simple iOS app based on the Single View Application template with Xcode. We will recognize the usage of object-oriented code included in the template, that is, before we add components and code to the app. Then, we will take advantage of the GameRepository
class we created in the previous chapter and use it to populate a UI element.
Tip
You will need Xcode 8 or greater in order to work with this example.
Navigate to File | New | Project... in Xcode. Click on iOS at the top of the Choose a template for your new project dialog box. Select Single View Application and click on Next, as shown in the following screenshot:
Enter Chapter 8
in Product Name and select Swift in language and Universal in Devices, as shown in the next screenshot. This way, we will...