An encapsulation of the design-time view controller graph represented in an Interface Builder storyboard resource file.
- iOS 5.0+
- Mac Catalyst 13.0+Beta
- tvOS 9.0+
UIStoryboard object manages archived versions of your app's view controllers. At design time, you configure the content of your view controllers visually, and Xcode saves the data needed to recreate that interface in a storyboard file in your app's bundle. When you want to create a new view controller programmatically, first create a
UIStoryboard object and specify the appropriate name and bundle information. Then use that object to instantiate the specific view controller that you want.
During the instantiation process,
UIStoryboard creates your view controller programmatically using its
init(coder:) method. The storyboard passes the view controller's data archive to that method, which then uses the data to recreate the state of the view controller and its views. If you have a custom initialization method for your view controller, you can ask the storyboard to instantiate your view controller using a block you provide. You can use this block to call your custom initialization method, passing any extra data your view controller needs.