title: OS X application by code swift
body: <p>I am coming from a background of a iOS engineer where I was not using Storyboards or XIBs at all. Now I have to make a Max OS X app and there are couple of issues.</p>
  
  <p>Is it worth doing it all by code? (or is it different to iOS in some fundamental ways that it should not be tried)</p>
  
  <p>How to do it by code?</p>
  
  <p>The approach I was trying is</p>
  
  <pre><code>func applicationDidFinishLaunching(aNotification: NSNotification) {
      var window = NSWindow(contentRect: self.articleViewController.view.frame, styleMask: NSBorderlessWindowMask, backing: NSBackingStoreType.Buffered, defer: false)
      window.contentViewController = self.articleViewController
      window.makeKeyAndOrderFront(window)
  }
  </code></pre>
  
  <p>But the app delegate doesn't get called. Then I found out that I need to create MainMenu.XIB(realy dont want to do it), but ok. Done that added App delegate as delegate on interface builder, but it still doesn't get called.</p>
  
  <p><img src="https://i.stack.imgur.com/egvWf.png" alt="enter image description here">
  I have @NSApplicationMain on the top, presumably that should call app delegate first.</p>