Trigger Segue Programmatically
suggest changePerformSegueWithIdentifier:
func performSegueWithIdentifier(identifier: String, sender: AnyObject?)
Initiates the segue with the specified identifier from the current view controller's storyboard file
Parameters
Identifier: String that identifies the triggered segue
Sender: The object that will initiate the segue.
Example in Swift
Performing a segue with identifier “SomeSpecificIdentifier” from a table view row selection:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
performSegueWithIdentifier("SomeSpecificIdentifier", sender: indexPath.item)
}
indexPath.item is the same value as row on NSIndexPath. item is the name collection views use. The call is Swift 2.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents