What’s the difference between all the Selection Segues?

Here is a quick summary of the segues and an example for each type.

Show – Pushes the destination view controller onto the navigation stack, sliding overtop from right to left, providing a back button to return – if not embedded in a navigation controller it will be presented modally
Example: Navigating in Settings, for example tapping General > About

Show Detail – For use in a split view controller, replaces the secondary view controller when in a multi-column interface, or if collapsed to one column it will push in the navigation controller
Example: In Messages, tapping a conversation will show the conversation details – replacing the view controller on the right when in a two column layout, or push the conversation when in a single column layout

Present Modally – Presents a view controller overtop the current view controller in various fashions as defined by the modal presentation and transition style – most commonly used to present a view controller in a sheet that animates up from the bottom
Example: Selecting Face ID & Passcode in Settings

Popover Presentation – When run on iPad, the destination appears in a popover, and tapping anywhere outside will dismiss it – popovers are supported on iPhone as well but by default it will present the view controller modally
Example: Tapping the + button in Calendar

Custom – You may implement your own custom segue and have control over its behavior

Embed – You may embed a view controller into another view controller, such as navigation, tab bar, and split view controllers as well as custom containers

Unwind – You may use an unwind segue to navigate back to a previous view controller, even if there’s many screens pushed/presented on top all of them will be dismissed

The deprecated segues are essentially the non-adaptive equivalents of those described above. These segue types were deprecated in iOS 8: Push, Modal, Popover, Replace.

For more info, you may read over the Using Segues documentation which also explains the types of segues and how to use them in a Storyboard. Also check out Session 216 Building Adaptive Apps with UIKit from WWDC 2014. They talked about how you can build adaptive apps using these new Adaptive Segues, and they built a demo project that utilizes these segues.

Leave a Comment

tech