Reputation: 13787
In objective-C, to move another viewcontroller from different storyboard, we will use following coding to fulfil what we want.
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Customer" bundle:nil];
HomeSummaryViewController *creaccVC = [storyboard instantiateViewControllerWithIdentifier:@"HomeSummaryViewController"];
[self.navigationController pushViewController:creaccVC animated:YES];
In swift version, please help me to how to do just like Objective-C?
Upvotes: 0
Views: 2869
Reputation: 11435
The above code in Swift looks like this:
let storyboard: UIStoryboard = UIStoryboard(name: "Customer", bundle: nil)
let homeView: HomeSummaryViewController = storyboard.instantiateViewControllerWithIdentifier("HomeSummaryViewController") as! HomeSummaryViewController
self.navigationController?.pushViewController(homeView, animated: true)
Upvotes: 0
Reputation: 26907
It's pretty much identical to the Objective-C version.
let storyboard = UIStoryboard(name: "Customer", bundle: nil)
let vc = storyboard.instantiateViewControllerWithIdentifier("HomeSummaryViewController")
self.navigationController?.pushViewController(vc, animated: true)
Upvotes: 5