Hello,

I’m playing with storyboards on OSX in a project that does nothing. One of the
things I’m trying to do is open a second window from a second storyboard.

I’ve a class function in a sub-subclass of NSWindowController named
OtherWindowController that does this:

    class func loadStoryboard(id: String) -> OtherWindowController? {
        var otherWindowController: OtherWindowController?

        if let storyboard = NSStoryboard(name: id, bundle: nil) {
            otherWindowController = 
storyboard.instantiateControllerWithIdentifier("initial") as? 
OtherWindowController
        }
        return otherWindowController
    }

It is called from this bit of code in the AppDelegate

    @IBAction func showOtherWindow(sender: AnyObject) {
        let otherWindowController =
            OtherWindowController.loadStoryboard(“Other")
        otherWindowController?.showWindow(sender)
    }

The window controller in the “Other” storyboard has a custom class of
“OtherWindowController" and a Storyboard ID of “initial”

When the code runs I get this error on the console:

Storyboard (<NSStoryboard: 0x610000004a60>) doesn't contain a controller with 
identifier ‘initial’

I also tried “instantiateInitialController”.  No errors written to the console
but the returned value is nil.

What am I doing wrong?

Marc


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/xcode-users/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to