OSDN Git Service

不要となっていたプロパティを削除
[kcd/KCD.git] / KCD / AppDelegate.swift
index 253a40e..f4fba39 100644 (file)
@@ -13,8 +13,7 @@ final class AppDelegate: NSObject {
     
     static var shared: AppDelegate {
         
-        // swiftlint:disable:next force_cast
-        return NSApplication.shared.delegate as! AppDelegate
+        return NSApplication.shared.delegate as! AppDelegate    // swiftlint:disable:this force_cast
     }
         
     let appNameForUserAgent: String = "KCD(1.9b36) is not Safari/604.4.7"
@@ -44,9 +43,11 @@ final class AppDelegate: NSObject {
     var screenShotSaveDirectory: String {
         
         get {
+            
             return UserDefaults.standard[.screenShotSaveDirectory] ?? ApplicationDirecrories.pictures.path
         }
         set {
+            
             UserDefaults.standard[.screenShotSaveDirectory] = newValue
         }
     }
@@ -116,11 +117,6 @@ final class AppDelegate: NSObject {
         
         return windowManager.createNewBrowser()
     }
-    
-    @objc func fire(_ timer: Timer) {
-        
-        updaters.forEach { $0() }
-    }
 }
 
 // MARK: - IBActions
@@ -251,12 +247,15 @@ extension AppDelegate {
             return true
             
         case #selector(AppDelegate.removeDatabaseFile(_:)):
+            
             return true
             
         case #selector(openInDeckBuilder(_:)):
+            
             return true
             
         default:
+            
             return windowManager.validateMenuItem(menuItem)
         }
     }
@@ -273,12 +272,10 @@ extension AppDelegate: NSApplicationDelegate {
             exit(0)
         }
         
-        NSUserNotificationCenter.default.delegate = self
-        Timer.scheduledTimer(timeInterval: 0.33,
-                             target: self,
-                             selector: #selector(AppDelegate.fire(_:)),
-                             userInfo: nil,
-                             repeats: true)
+        Timer.scheduledTimer(withTimeInterval: 0.33, repeats: true) { [weak self] _ in
+            
+            self?.updaters.forEach { $0() }
+        }
     }
     
     func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
@@ -310,6 +307,7 @@ extension AppDelegate: NSTouchBarProvider {
     var touchBar: NSTouchBar? {
         
         get {
+            
             if windowManager.isMainWindowMostFront {
                 
                 return nil