I have a ViewController with tableview called BasicPhrasesVC and I want to pass the data in the selected cell to display it on the next ViewController (called BasicPhrasesVC
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
selectedBasicPhrase = basicPhrases[indexPath.row]
self.performSegueWithIdentifier("BasicPhrasesVC2BasicDisplayVC", sender: selectedBasicPhrase)
}
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
if segue.identifier == "BasicPhrasesVC2BasicDisplayVC" {
if let nextVC = segue.destinationViewController as? NextViewController {
nextVC.selectedBasicPhrase = sender
}
}
}