App keeps terminating/crashing due to tableView:numberOfRowsInSection unrecognized selector sent to instance when cell is clicked.
I've ensured that I have added the dataSource and delegate protocols to both my swift file and my TableView. I have also ensured that the swift file connected to the ViewController is the correct one. Whenever I select a cell in the TableView it crashes.
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return values.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
let mainData = values[indexPath.row] as? [String:Any]
cell.textLabel?.text = mainData?["listName"] as? String
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
performSegue(withIdentifier: "selectList", sender: self)
}