When working with UIViewController, UICollectionViewController, and UITableViewController, you need to create a class file for each of these elements. Each file handles all of the logic and interactions that the controller sends and receives. Along with interactions, the class file is responsible for receiving data. We can see what this looks like in Playground. Let's see how this works:
- Right-click on the Playgrounds folder and go to New File.
- Scroll to the bottom of the template screen, select a Blank playground, and hit Next.
- In the options screen that appears, name your new Playground CollectionViewBasics, and make sure that your Platform is set to iOS. Hit Next and then Create. Delete the variable and leave the import statement, then toggle open/on the Debug Panel, using either the toggle button or command + shift + Y.
Now that we are set...