Что я делаю не так? Объявление не работает.
это мой код.
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
guard let appDelegate =
UIApplication.shared.delegate as? AppDelegate else {
return
}
let managedContext =
appDelegate.persistentContainer.viewContext
let fetchRequest =
NSFetchRequest<NSManagedObject>(entityName: "Waypoints")
do {
waypoint = try managedContext.fetch(fetchRequest)
} catch let error as NSError {
print("Could not fetch. \(error), \(error.userInfo)")
}
}
extension ViewControllerWaypoints: UITableViewDataSource {
func tableView(_ tableView: UITableView,
numberOfRowsInSection section: Int) -> Int {
return waypoint.count
}
func tableView(_ tableView: UITableView,
cellForRowAt indexPath: IndexPath)
-> UITableViewCell {
let waypoints = waypoint[indexPath.row]
let cell =
tableView.dequeueReusableCell(withIdentifier: "Cell",
for: indexPath)
cell.accessoryType = .disclosureIndicator
cell.isUserInteractionEnabled = true
cell.textLabel?.text =
waypoints.value(forKeyPath: "name") as? String
return cell
}
func tableView(_ tableView: UITableView,
didSelectRowAt indexPath: IndexPath) {
print("User selected cell....") //
}
У меня проблема с кодом (при использовании табличного представления), объявление в функции: didSelectRowAt - не вызывается ... Что я делаю не так? Декларация не работает.
Большое спасибо за вашу помощь и за все ответы.