PrepareForSegue:

func prepareForSegue(_ segue:UIStoryboardSegue, sender sender:AnyObject?)

Notifies the view controller that a segue is about to be performed

Parameters

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
    }
}