Currently, LocationViewController has no way of communicating with the table view. In this section, you will create a new outlet in LocationViewController and assign the table view to it. Follow these steps to do so:
- Click the Navigator and Inspector buttons to hide the Navigator and Inspector areas, as shown in the following screenshot:
- Click the Adjust Editor Options button, as shown in the following screenshot:
- Choose Assistant from the menu, as shown in the following screenshot:
- Click the table view in the document outline. The assistant editor should be set to Automatic > LocationViewController.swift:
- Ctrl + Drag from the table view to the space just above viewDidLoad():
- In the pop-up menu, enter tableView in the Name field and click Connect:
- The tableView outlet has been added to LocationViewController and connected to the table view in the storyboard:
- Click the x button to close the assistant editor:
As you saw in the playground, in order for a table view to display data and respond to user interaction, a view controller for a table view needs to adopt the table view data source and delegate protocols and implement the required methods. You will do that next.