Understanding Collection Views

The first thing we want to do is get access to all of the UI and Playground components that we will need. At the very top of the playground, please add the following import statements:

import UIKitimport PlaygroundSupport

The first import statement imports all of the UI elements we will need. The second import gives us access to Playground support, this will allow us to add our UI elements into playgrounds. Now let's create our first UIViewController, this setup is pretty much the same structure I like to use for all of my classes that are controllers. Add a line break and then add the following code:

class CollectionViewExampleController:UIViewController {      }

This code looks pretty similar to what we discussed ...

Get iOS 12 Programming for Beginners - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.