To program segue programmatically, you need to do the following:
1. Configure it in Storyboard with , by dragging the desired segment between the two view controllers and set its identifier (for example, in your case it is “popOutNoteExpanded”) in the “Attribute inspector” section.
2. Name it programmatically
performSegue(withIdentifier: "popOutNoteExpanded", sender: cell)
Verify that your ID is set correctly.
Also, in the code above, you put the wrong sender . In your prepare () method, you use the sender as a UITableViewCell, but you call the performSegue () function with the sender as IndexPath.
You need a cell by calling:
let cell = tableView.cellForRow(at: indexPath)
And then you can execute segue:
performSegue(withIdentifier: "popOutNoteExpanded", sender: cell)
Quang nguyen
source share