Skip to content

Instantly share code, notes, and snippets.

@anitaa1990
Last active April 28, 2018 11:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anitaa1990/af72734a99d957597c8a339f52260602 to your computer and use it in GitHub Desktop.
Save anitaa1990/af72734a99d957597c8a339f52260602 to your computer and use it in GitHub Desktop.
This example illustrates how to push a view controller to the top of the navigation stack
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
@IBAction func handleLoginAction(_ sender: Any) {
/* Step 1 */
/*
* This example is when we want to push a view controller to the top of the navigation backstack
*/
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
let viewControllerB = storyBoard.instantiateViewControllerWithIdentifier("nextView") as! ViewControllerB
self.presentViewController(viewControllerB, animated:true, completion:nil)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment