I have segues going to two different ViewControllers, Detail & Search. The segues going to Detail are working fine, but the one going to Search keeps crashing the app. I have spent two hours reading similar questions but none of them seem to have the same issue:
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
let detailVC = segue.destination as! DetailViewController
if segue.identifier == "newDocSegue" {
// Create a new document and pass it to the detail view.
detailVC.doc = Document()
detailVC.isAddAction = true
}
if segue.identifier == "editDocSegue" {
// Load the existing document into the detail view, for editing.
let indexPath = tableView.indexPath(for: sender as! UITableViewCell)!
detailVC.doc = Document[indexPath.row]
detailVC.isAddAction = false
}
else if segue.identifier == "searchSegue" {
shouldPerformSegue(withIdentifier: "searchSegue", sender: Any?.self)
}
}