View Controller Transitions

One of the first things developers learn when beginning iOS development is how to transition between the various scenes of the application and how to pass data between view controllers.1

The typical approach to this is to drag a few UIViewControllers on your storyboard (if you are using storyboards), connect them with segues, give the segues identifier names and when an event that asks for a transition occurs, make the appropriate preparations inside the prepareForSegue: method.

This approach is fine and works great for small-sized apps but when an app uses more than 2-4 scenes, then a much cleaner solution is needed to help with the maintenance and extension of the code base. 2
Continue…


  1. This problem is of course hardly unique to iOS. Any application with a GUI faces this situation. The methodology used in this article can be applied to most technologies/languages.

  2. We will be using a simple 3 screen example here, but the methodology described in this article can be applied to both simple and complex (many scenes deep) hierarchies. For more complex cases, take a look at this example that goes one step further and uses the State Design Pattern to avoid cluttering the Mediator class.