Preparing your view controller before a triggering a Segue

suggest change


func prepareForSegue(_ segue:UIStoryboardSegue, sender sender:AnyObject?)
Notifies the view controller that a segue is about to be performed


segue: The segue object.

sender: The object that initialized the segue.

Example in Swift

Perform a task if the identifier of the segue is ‚ÄúSomeSpecificIdentifier‚ÄĚ

override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
    if segue.identifier == "SomeSpecificIdentifier" {
        //- Do specific task

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents