qed
qed

Reputation: 23134

instantiateInitialViewController(withIdentifier: String) does not exist?

Here is a screenshot from Xcode 8.2:

enter image description here

If the function does not exist, how do you add identifier to a view controller these days?

Upvotes: 4

Views: 3128

Answers (2)

jrbedard
jrbedard

Reputation: 3730

Use instead instantiateViewController(withIdentifier:) when you would like a ViewController and attach a view from the storyboard (UIStoryboard Id Identifier)

instantiateInitialViewController() is to instantiate the default view initial, this function takes no argument and is something you wouldn't usually do programmatically.

Upvotes: 5

InkGolem
InkGolem

Reputation: 2762

let sb = UIStoryboard(name: "", bundle: Bundle.main)
sb.instantiateViewController(withIdentifier: "blue")

Upvotes: 4

Related Questions