Now that we are maintaining a list of photos, we need to display it in our collection view. A collection view is populated when you provide a data source to it that implements its
UICollectionViewDataSource protocol. Probably, the most common thing to do is to let the view controller be the data source. We can do this by opening
Main.storyboard and control dragging from the collection view to the view controller:
After releasing the mouse, select
dataSource from the menu. After that, all we need to do is implement the data source protocol. The two methods we need to implement are
collectionView:numberOfItemsInSection: and ...