let mainStoryboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
//Get Initial ViewController
let mainViewController = mainStoryboard.instantiateInitialViewController()
//Get ViewController by Id
//Make sure you give the view controller in your storyboard a Storyboard ID inside the identity inspector.
let mainViewController = mainStoryboard.instantiateViewController(withIdentifier: "myId")
All one can think and do in a short time is to think what one already knows and to do as one has always done!
iOS Swift instantiate view controllers from Storyboard
You can use a storyboard object to instantiate the initial view controller or instantiate other view controllers that you want to present programmatically using the identifier.
No comments:
Post a Comment
NO JUNK, Please try to keep this clean and related to the topic at hand.
Comments are for users to ask questions, collaborate or improve on existing.