Created
June 20, 2017 15:14
-
-
Save yanli0303/0c3585114ff51405775a9beb9891349b to your computer and use it in GitHub Desktop.
NSWindowController.close() does not stopModal or endSheet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Cocoa | |
class FooWC: NSWindowController { | |
} | |
extension FooWC: NSWindowDelegate { | |
func windowWillClose(_ notification: Notification) { | |
guard let win = notification.object as? NSWindow else { | |
return | |
} | |
if win.isModalPanel { | |
NSApp.abortModal() | |
} | |
if let sheetParent = win.sheetParent { | |
sheetParent.endSheet(win) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment