The code in question:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
tableView.deselectRowAtIndexPath(indexPath, animated: true)
var card: String
if (tableView == self.searchDisplayController?.searchResultsTableView){
card = self.filtered[indexPath.row]
}
else{
card = self.array[indexPath.row]
}
let destinationVC = SearchViewController()
destinationVC.searchString = card
destinationVC.performSegueWithIdentifier("ResultSegue", sender: self)
}
I'm trying to pass a string to another view when a cell in my table is selected. In the storyboard I named the segue identifier 'ResultSegue'.
What happens when I run my app is when I click a cell it loads the next view, without the variable I'm sending being updated, then if I go back and click on a new cell the app will crash and give me the titled warning.
I've tried running clean, and resetting the simulator as other threads have suggested, but nothing changes.