I would like to hide/close my main app window in func viewDidLoad()
and only show/unhide the main window if some event requires it.
I tried self.view.window?.close()
but this leaves a white window. I also tried NSApp.hide(nil)
but then I can't unhide with NSApp.unhide(nil)
. Here is some sample code:
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
NSApp.hide(nil)
runTest()
}
func runTest () {
let check = false
if check == false {
NSApp.unhide(nil)
}
}