Let's now link our file, RestaurantViewController, to our new UIViewController in the storyboard:
- Select the UIViewController with the Collection View that we just created.
- In the Utility panel, select the Identity inspector. Under Custom Class, in the Class drop-down menu, select RestaurantViewController and hit the Enter key.
- Select the Connections Inspector in the Utilities Panel.
- Under Outlets, (just like we did earlier) click on the collectionView circle and drag from the circle to the Collection View that we just added inside of your UIViewController.
Now that we have our Collection View hooked up, we need to hook up the data source and delegate. The data source and delegate allow us to pass data to our Collection View as well as to know when our Collection View has some interaction. Let's do that now by doing the following:
- In your scene, select your Collection View. In your Utilities Panel, select the Connections Inspector.
- Click on and drag the dataSource property to the Restaurant View Controller in your Outline view.
- Click on and drag the delegate property to the Restaurant View Controller in your Outline view.
Finally, let's set up our cell to have a color.