Reputation: 3370
How can I prevent my NSWindow from being closed when the windowWillClose
method is called?
Upvotes: 0
Views: 2036
Reputation: 6370
Swift example:
You need to set the delegate of the NSWindow
and implement NSWindowDelegate
func windowShouldClose(_ sender: NSWindow) -> Bool {
return false
}
Upvotes: 0
Reputation: 24125
You can't. By the time windowWillClose:
is called, it is too late. You need to stop it before this point with windowShouldClose:
.
Upvotes: 5