Exit Segues

There are a few ways we could implement the back button, but the most generally useful is the exit segue. With an exit segue, we can go backward in a navigation, regardless of whether we came by way of push or modal segues.

What’s tricky about exit segues is that they don’t appear on the storyboard the same way push or modal segues do. Instead, their existence is implicit. We can only perform an exit segue if a previous view controller has exposed a method for us to come back to. These methods, commonly called unwind methods, have to follow a certain signature—they take a UIStoryboardSegue parameter and have return type IBAction—but they don’t have to have any code—they just have to exist.

We want our user detail view controller ...

Get iOS 9 SDK Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.