Using the Storyboard Segue

When we tap a cell in the list of tweets, we navigate to the new view controller, which we’ll customize to show the details for the selected tweet. But hold on—how do we know which tweet was selected? And how will we communicate that to the other view controller?

This is where the segue can help us. Prior to performing a transition between view controllers, the current view controller gets a callback on the method prepareForSegue, passing in details of the transition in a UIStoryboardSegue object. As inherited from UIViewController, this method does nothing, but we can override it to take some interesting action, based both on our current state and details of the segue.

The UIStoryboardSegue object provides properties ...

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.