O'Reilly logo

Learn iOS 11 Programming with Swift 4 - Second Edition by Craig Clayton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Showing restaurants 

We will be showing 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 done it before.

  1. 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?
  1. Next, we need to set up our Collection View defaults. Add the following method inside of a private extension:
private extension MessagesViewController {    func setupCollectionView() {        let flow = UICollectionViewFlowLayout() flow.sectionInset = UIEdgeInsets(top: 7, left: 7, bottom: 7, right: 7) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required