You need to declare your tableView different with your @IBOutlet , since you use the UIViewController and put the tableView in its view. Currently, the UIViewController does not know which tableView you are accessing either.
@IBOutlet var tableView: UITableView!
Then link it in the interface builder, as was done with other @IBOutlet s. Make sure you link the delegate and dataSource your tableView back to the view controller.
To do this, after selecting the tableView , select the "Connection Inspectors" area, as shown in the figure below, and return them to the UIViewController .

myles
source share