instantiateController(withIdentifier:)
Instantiates a specified view controller or window controller from a storyboard.
Declaration
func instantiateController(withIdentifier identifier: NSStoryboard.SceneIdentifier) -> AnyParameters
- identifier:
The unique identifier for the controller, which you have specified using the Identity inspector in Interface Builder.
Return Value
The instantiated view controller or window controller identified by the identifier parameter, from the storyboard file. If the specified identifier does not exist (or is nil) in the storyboard file, this method raises an exception.
Discussion
Use this method to create a view controller or window controller object that you want to manipulate and present programmatically. Your controller object must have an identifier string. In Xcode’s storyboard editor, select your controller, display the identity inspector, and place this string in the Storyboard ID field.
This method creates a new instance of the specified controller each time you call it.