I have a UIViewController which should show me DetailInformations depending on what Cell was pressed in the UITableViewController.
For the moment I am passing them throu
Try using indexPathForSelectedRow
in prepareForSegue
as of it looks like that you have created segue from UITableViewCell
to the Destination ViewController
so that prepareForSegue
will call before the didSelectRowAt
.
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "show" {
var ctrl = segue.destination as! DetailViewController
if let indexPath = self.tableView.indexPathForSelectedRow {
ctrl.information = _informationList[indexPath.row]
}
}
}