diff --git a/Packages/vChewing_CocoaExtension/Sources/CocoaExtension/CocoaExtension_Misc.swift b/Packages/vChewing_CocoaExtension/Sources/CocoaExtension/CocoaExtension_Misc.swift index e65be034..bd0921d1 100644 --- a/Packages/vChewing_CocoaExtension/Sources/CocoaExtension/CocoaExtension_Misc.swift +++ b/Packages/vChewing_CocoaExtension/Sources/CocoaExtension/CocoaExtension_Misc.swift @@ -50,7 +50,7 @@ extension NSApplication { public static var isDarkMode: Bool { if #unavailable(macOS 10.14) { return false } if #available(macOS 10.15, *) { - let appearanceDescription = NSApplication.shared.effectiveAppearance.debugDescription + let appearanceDescription = NSApp.effectiveAppearance.debugDescription .lowercased() return appearanceDescription.contains("dark") } else if let appleInterfaceStyle = UserDefaults.standard.string(forKey: "AppleInterfaceStyle") { diff --git a/Packages/vChewing_Uninstaller/Sources/Uninstaller/Uninstaller.swift b/Packages/vChewing_Uninstaller/Sources/Uninstaller/Uninstaller.swift index 5d4222ef..cfcb909b 100644 --- a/Packages/vChewing_Uninstaller/Sources/Uninstaller/Uninstaller.swift +++ b/Packages/vChewing_Uninstaller/Sources/Uninstaller/Uninstaller.swift @@ -67,7 +67,7 @@ public enum Uninstaller { if !FileManager.trashTargetIfExists(pathIMELibrary + kTargetBundle) { return -1 } // 最後移除 App 自身 // 幹掉殘留在記憶體內的執行緒。 if selfKill { - NSApplication.shared.terminate(nil) + NSApp.terminate(nil) } return 0 } diff --git a/Source/Modules/AppDelegate.swift b/Source/Modules/AppDelegate.swift index 09e2fb05..640d5fc1 100644 --- a/Source/Modules/AppDelegate.swift +++ b/Source/Modules/AppDelegate.swift @@ -114,6 +114,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSUserNotificationCenterDele // New About Window @IBAction func about(_: Any) { CtlAboutWindow.show() - NSApplication.shared.activate(ignoringOtherApps: true) + NSApp.activate(ignoringOtherApps: true) } } diff --git a/Source/Modules/UIModules/PrefUI/VwrPrefPaneDevZone.swift b/Source/Modules/UIModules/PrefUI/VwrPrefPaneDevZone.swift index 77af68bf..8a6823ed 100644 --- a/Source/Modules/UIModules/PrefUI/VwrPrefPaneDevZone.swift +++ b/Source/Modules/UIModules/PrefUI/VwrPrefPaneDevZone.swift @@ -55,7 +55,7 @@ struct VwrPrefPaneDevZone: View { isOn: $selUseIMKCandidateWindow.onChange { PrefMgr.shared.useIMKCandidateWindow = selUseIMKCandidateWindow NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.") - NSApplication.shared.terminate(nil) + NSApp.terminate(nil) } ) Text( diff --git a/Source/Modules/UIModules/PrefUI/VwrPrefPaneDictionary.swift b/Source/Modules/UIModules/PrefUI/VwrPrefPaneDictionary.swift index ebe067cf..910d817d 100644 --- a/Source/Modules/UIModules/PrefUI/VwrPrefPaneDictionary.swift +++ b/Source/Modules/UIModules/PrefUI/VwrPrefPaneDictionary.swift @@ -88,7 +88,7 @@ struct VwrPrefPaneDictionary: View { PrefMgr.shared.userDataFolderSpecified = newPath tbxUserDataPathSpecified = PrefMgr.shared.userDataFolderSpecified BookmarkManager.shared.saveBookmark(for: url) - (NSApplication.shared.delegate as! AppDelegate).updateDirectoryMonitorPath() + (NSApp.delegate as! AppDelegate).updateDirectoryMonitorPath() } else { IMEApp.buzz() if !bolPreviousFolderValidity { diff --git a/Source/Modules/UIModules/PrefUI/VwrPrefPaneGeneral.swift b/Source/Modules/UIModules/PrefUI/VwrPrefPaneGeneral.swift index 190a52f2..57e749f0 100644 --- a/Source/Modules/UIModules/PrefUI/VwrPrefPaneGeneral.swift +++ b/Source/Modules/UIModules/PrefUI/VwrPrefPaneGeneral.swift @@ -99,7 +99,7 @@ struct VwrPrefPaneGeneral: View { UserDefaults.standard.removeObject(forKey: UserDef.kAppleLanguages.rawValue) } NSLog("vChewing App self-terminated due to UI language change.") - NSApplication.shared.terminate(nil) + NSApp.terminate(nil) } ) { Text(LocalizedStringKey("Follow OS settings")).tag(["auto"]) diff --git a/Source/Modules/WindowControllers/CtlPrefWindow.swift b/Source/Modules/WindowControllers/CtlPrefWindow.swift index 42d50916..fa398b7a 100644 --- a/Source/Modules/WindowControllers/CtlPrefWindow.swift +++ b/Source/Modules/WindowControllers/CtlPrefWindow.swift @@ -194,13 +194,13 @@ class CtlPrefWindow: NSWindowController { } NSLog("vChewing App self-terminated due to UI language change.") - NSApplication.shared.terminate(nil) + NSApp.terminate(nil) } } @IBAction func updateIMKCandidateEnableStatusAction(_: Any) { NSLog("vChewing App self-terminated due to enabling / disabling IMK candidate window.") - NSApplication.shared.terminate(nil) + NSApp.terminate(nil) } @IBAction func clickedWhetherIMEShouldNotFartToggleAction(_: Any) { @@ -260,7 +260,7 @@ class CtlPrefWindow: NSWindowController { if LMMgr.checkIfSpecifiedUserDataFolderValid(newPath) { PrefMgr.shared.userDataFolderSpecified = newPath BookmarkManager.shared.saveBookmark(for: url) - (NSApplication.shared.delegate as! AppDelegate).updateDirectoryMonitorPath() + (NSApp.delegate as! AppDelegate).updateDirectoryMonitorPath() } else { IMEApp.buzz() if !bolPreviousFolderValidity { diff --git a/UserPhraseEditor/AppDelegate.swift b/UserPhraseEditor/AppDelegate.swift index f0cefbc3..188c7b7f 100644 --- a/UserPhraseEditor/AppDelegate.swift +++ b/UserPhraseEditor/AppDelegate.swift @@ -25,6 +25,6 @@ class AppDelegate: NSObject, NSApplicationDelegate { // Call the New About Window @IBAction func about(_: Any) { CtlAboutWindow.show() - NSApplication.shared.activate(ignoringOtherApps: true) + NSApp.activate(ignoringOtherApps: true) } }