Skip to content

Instantly share code, notes, and snippets.

@neatlife
Created May 5, 2020 02:13
Show Gist options
  • Save neatlife/b56a7e88baffa79e6343fc44458641f7 to your computer and use it in GitHub Desktop.
Save neatlife/b56a7e88baffa79e6343fc44458641f7 to your computer and use it in GitHub Desktop.
关闭macos最后一个窗口退出应用
import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
}
func applicationWillTerminate(_ aNotification: Notification) {
// Insert code here to tear down your application
}
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment