Reputation: 588
I am a .Net Developer and just started my first iOS project using swift. I want to navigate from one view controller to another using code. Like we do in WP 8.1 with the help of following code:
Frame.Navigate(Typeof("Page_2"));
Upvotes: 2
Views: 233
Reputation: 7168
Another way that you can do it depending on how you are calling or executing the code.
self.performSegueWithIdentifier("YourSegueIdentifier", sender: self)
Upvotes: 2
Reputation: 314
Give your destination view controller an identifier (in storyboard). Then, put this into the view controller you're navigating from...
let controller = self.sender.storyboard?.instantiateViewControllerWithIdentifier("resultController") as! ResultController
controller.myViewModel= myViewModel!
self.sender.navigationController?.pushViewController(controller, animated: true)
Upvotes: 0