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.


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 ...

Get Swift 3 ObjectOriented Programming - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.