swift - Open window from menu -


how can open new window xib file in swift2? i've created new nswindowcontroller + xib, can't find how open it?

@ibaction func openpreferences(sender: nsmenuitem) {     let wc = settingsviewcontroller()     //... } 

i've decided use custom storyboard instead of xib nsview. here code.

appdelegate.swift:

class appdelegate: nsobject, nsapplicationdelegate {     lazy var settingscontroller: nswindowcontroller? =         nsstoryboard(name: "settingsstoryboard", bundle: nil).instantiatecontrollerwithidentifier("settingswc")         as? nswindowcontroller      @ibaction func openpreferences(sender: nsmenuitem) {         if let controller = settingscontroller { controller.showwindow(self) }     }  } 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -