Unwind Segues through Storyboard

There are plenty of different ways that you can segue back to your first view. I was curious on how to perform this through interface builder. I had heard that you can control-drag a button to the exit button on a view and it will know to perform an unwind segue. There are couple caveats though.

Lets create three view controllers, classes for each view controller, a button on each view controller that segue to the next view and embed a navigation controller.

So here’s the weird part. Now to go your first view controller and type this method.

Now that you have added this code, interface builder will know what view to go to. You can control-drag your third view controller button to the exit button.

Then you should see this, then click it.

You are all set! It should work. If you were ever curious how to control-drag a button to a exit button and have it perform an unwind segue, now you know.

Show your support

Clapping shows how much you appreciated Mason Macias’s story.