Can't Connect window to IBOutlet with storyboard

I’m trying to access the Window in the AppDelegate. If I make a new OSX Cocoa project without storyboards, then the AppDelegate contains a window variable like so

class AppDelegate: NSObject, NSApplicationDelegate {

    @IBOutlet weak var window: NSWindow!

I can delete the connection between the outlet and the window and reconnect it over and over again and it works fine.

  • Xcode is loading in OS X objects instead of iOS objects
  • How do I find out what exception was thrown in the Xcode debugger (for iPhone)?
  • Swift Assertions behaviour in production applications
  • How to distribute Java application 7.0 and above on Mac 10 and above?
  • Writing to files in bundle?
  • xcode - load localized images with the same name, not using nslozalicedstring
  • Now if I create a new OSX Cocoa project with storyboards and add the window variable to the AppDelegate and try to control drag the outlet to the window the same as I did on the project without story boards it doesn’t work.

    Any suggestions?

    (OSX 10.11.5 Xcode 7.3.1 (and 8 beta 6) swift 2.2 (and 3))

    I know I can do it in code just don’t know why I can’t connect the outlet.

    Solutions Collect From Internet About “Can't Connect window to IBOutlet with storyboard”

    Storyboards are composed of scenes, and each scene can be thought of as a single xib file. You can’t make connections (actions, outlets, etc) between objects residing in separate xibs, and – analogously – you can’t make connections between objects residing in separate scenes in a storyboard.

    In the default storyboard setup, your AppDelegate object and the window object are housed in separate scenes – hence why you can’t create the outlet:

    enter image description here

    By contrast, in a xib app both objects reside in the same xib file so creating a connection is possible.