AppDelegate.swift 614 B

12345678910111213141516171819202122232425
  1. import Cocoa
  2. import FlutterMacOS
  3. @NSApplicationMain
  4. class AppDelegate: FlutterAppDelegate {
  5. override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
  6. return false
  7. }
  8. override func applicationShouldHandleReopen(_ sender: NSApplication, hasVisibleWindows flag: Bool)
  9. -> Bool
  10. {
  11. if !flag {
  12. for window in NSApp.windows {
  13. if !window.isVisible {
  14. window.setIsVisible(true)
  15. }
  16. window.makeKeyAndOrderFront(self)
  17. NSApp.activate(ignoringOtherApps: true)
  18. }
  19. }
  20. return true
  21. }
  22. }