We will display a list of restaurants, just like in our app, but we will not be doing the entire interface. Most of this code will be familiar to you, as we have used it before:
- Open up the MessagesViewController.swift file in the Navigator panel and add the following code inside of the class declaration:
@IBOutlet var collectionView: UICollectionView!
let manager = RestaurantDataManager()
var selectedRestaurant:RestaurantItem?
- Set up the Collection View defaults. Add the following method inside a private extension:
private extension MessagesViewController {
func setupCollectionView() {
let flow = UICollectionViewFlowLayout()
flow.sectionInset = UIEdgeInsets(top: 7, left: 7, bottom: 7, right: 7)
flow.minimumInteritemSpacing = 0
flow.minimumLineSpacing = 7
collectionView.collectionViewLayout = flow
collectionView...