How to move to multiple view controllers?

swift, uiviewcontroller

Solution

There are many ways to do this detailed in the class documentation for `UIViewController`.

Example 1 Here is an example of using the `-presentViewConroller:` method (assuming this code is written in a `UIViewController` subclass):

var secondViewController = UIViewController() //create your second view controller. 
self.presentViewController(secondViewController, true, NULL)

Example 2 This is how you would present the second `UIViewController` via storyboards (again assuming this code is written in a `UIViewController` subclass):

self.preformSegueWithIdentifier("segueIdentfier", self);

Problem

I want to programmatically move from a viewController to another using Apple's new Swift language. I've googled and read through the docs, and I see how to use a single ViewController. Does anyone have an example or documentation on how to switch between View Controllers?

Original source