Setting Initial View Controller Programmatically Swift

Viewed 22653

I have seen lengthy Objective-C answers to this here on stack overflow, but no swift answers.

How can I change the initial view controller programmatically in swift, from a view controller?

I would think it would go something like this:

let storyboard = UIStoryboard(name: "Main", bundle: nil)
storyboard.setInitialViewController(identifier: ViewController())

But no, this doesn't do anything. The first line is good, but the second line's functions just don't exist.

3 Answers
Related