You speak of a Location button.
You do not show its IBAction.
In addition, LocationViewController should also conform to UITableViewDelegate
'Datasource & Delegate' outlets were formed by dragging from the connection view 'Datasource & Delegate' to the LocationViewController
This is not very clear.
You'd better set the delegate in viewDidLoad
override func viewDidLoad() {
super.viewDidLoad()
tableView.delegate = self
tableView.dataSource = self
}
So please provide more comprehensive code so that we can find what is happening.
import UIKit
class LocationViewController: UIViewController, UITableViewDataSource {
@IBOutlet weak var tableView: UITableView!
let manager = LocationDataManager()
override func viewDidLoad() {
super.viewDidLoad()
}
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) - Int {
10
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) - UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "locationCell", for: indexPath)
cell.textLabel?.text = "A Cell"
return cell
}
}
Finally, do an option-clean build folder, as it seems you have moved things around.
Topic:
Programming Languages
SubTopic:
Swift
Tags: