How can I programmatically close a window in cocoa mac ? I have opened a second window/xib from the first window/xib using button click. I need to close the first window/xib pro
This is for someone who is using Swift
and NSStoryBoardSegue
, here is the same way to achieve it
NSApplication.sharedApplication().mainWindow?.close() // close current window first
self.performSegueWithIdentifier("id_of_your_segue", sender: self) // open the second view by invoking the segue that is set to connect two views.