Displaying data in our static Table View

Next, we need to create a method that will display all of our data in our labels.

Open the RestaurantDetailViewController.swift file and add the private extension after the last curly brace:

private extension RestaurantDetailViewController {    func setupLabels() {        guard let restaurant = selectedRestaurant else { return }            if let name = restaurant.name {            lblName.text = name            title = name        }        if let cuisine = restaurant.subtitle { lblCuisine.text = cuisine }            if let address = restaurant.address {            lblAddress.text = address            lblHeaderAddress.text = address        }        lblTableDetails.text = "Table for 7, tonight at 10:00 PM"    }}

This method will now get the data and display it inside our labels. Next, we want to display ...

Get iOS 12 Programming for Beginners - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.