iOS Using Segues to navigate backwards in the navigation stack


Example


Unwind Segues

Unwind Segues give you a way to “unwind” the navigation stack and specify a destination to go back to. The signature of this function is key to Interface Builder recognizing it. It must have a return value of IBAction and take one parameter of UIStoryboardSegue. The name of the function does not matter. In fact, the function does not even have to do anything. It’s just there as a marker of which UIViewController is the destination of the Unwind Segue. [source][1]

Required signature of an unwind segue

Objective C:

-(IBAction)prepareForUnwind:(UIStoryboardSegue *)segue {
}

Swift:

@IBAction func prepareForUnwind(segue: UIStoryboardSegue) {
}