如何防止故事板打开 window

how to prevent storyboard from opening a window

我正在编写一个加载到状态栏的简单应用程序,单击它会在状态栏图标下方打开一个弹出窗口。我正在使用故事板来定义我喜欢在弹出窗口中显示的 UI。问题是,一旦我实例化故事板,就会打开 window。我怎样才能防止这种情况发生?这是我的应用程序委托中的代码:

func applicationDidFinishLaunching(aNotification: NSNotification) {
    let mainBoard = NSStoryboard(name: "MainBoard", bundle: nil)
}
import Cocoa

@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
    var defaultWindow:NSWindow!
    func applicationDidFinishLaunching(aNotification: NSNotification) {
        defaultWindow = NSApplication.sharedApplication().windows.first as? NSWindow
        defaultWindow.close()

    }
    func applicationWillTerminate(aNotification: NSNotification) {
        // Insert code here to tear down your application
    }
    @IBAction func menuClick(sender: AnyObject) {
        defaultWindow.makeKeyAndOrderFront(nil)
    }
}

更新:Xcode 7.1.1 • Swift 2.1

NSApplication.sharedApplication().windows.first?.close()