NSStoryboard in swift

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

NSStoryboard in swift

Marco S Hyman
NSStoryboard changed between Xcode 6 and Xcode 7 (I’m running beta 2).
The swiftified version of the initializer is

    /* This method instantiates a storyboard to represent the file with 'name' in the given bundle. The bundle argument is used to resolve resource references, typically to images, in the archived controllers. The bundle argument can be nil indicating that the main bundle should be used. */
    convenience init(name: String, bundle storyboardBundleOrNil: NSBundle?)

And if the storyboard doesn’t exist? In an app it calls objc_exception_throw
which leaves a nice message on the console.


Then there is this...
   
    /* Every storyboard may have an initial view or window controller. Each invocation of this method instantiates an instance of the initial controller. The developer chooses the initial controller in an inspector within Interface Builder. */
    func instantiateInitialController() -> AnyObject

The comment is correct.  A storyboard *may* have an initial controller.  It
may not.   I didn’t test to see how the code might crash if the function is
called for a storyboard without a specified initial controller.

Radar 21551077

--
You received this message because you are subscribed to the Google Groups "Swift Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/swift-language/4CF805E0-0D48-430E-AD0E-2D3C3A8FBE84%40snafu.org.
For more options, visit https://groups.google.com/d/optout.