0
Pourquoi Xcode me dit-il que performSegue (withIdentifier :) est un identificateur non résolu? (S'il vous plaît voir commenté la ligne)Utilisation de l'identificateur non résolu erreur "performSegue"
import UIKit
class AllListsViewController: UITableViewController {
override func viewDidLoad() {
super.viewDidLoad()
// Uncomment the following line to preserve selection between presentations
// self.clearsSelectionOnViewWillAppear = false
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem()
}
// MARK: - Table view data source
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return 3
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = makeCell(for: tableView)
cell.textLabel!.text = "List \(indexPath.row)"
return cell
}
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
performSegue(withIdentifier: "ShowChecklist", sender: nil) // Use of unresolved identifier "performSegue"
}
func makeCell(for tableView: UITableView) -> UITableViewCell {
let cellIdentifier = "Cell"
if let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier) {
return cell
} else {
return UITableViewCell(style: .default, reuseIdentifier: cellIdentifier)
}
}
J'ai mis à jour votre code avec un indentation appropriée. L'erreur est très claire maintenant. – rmaddy
@NiravD Il n'y a pas de '}' supplémentaire. Voir le code avec indentation appropriée. – rmaddy
@NiravD, vous avez presque raison, ce n'est pas un '' 'supplémentaire, mais c'est au mauvais endroit. –