From 40b3a5a146b40919e7161706554e81e3441067f8 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Sat, 15 Jun 2019 10:22:07 -0700 Subject: [PATCH] Removing unneccesary @objc annotations. --- Clocker/Clocker/LocationController.swift | 12 ++++++------ Clocker/Events and Reminders/EventCenter.swift | 2 +- Clocker/Menu Bar/MenubarHandler.swift | 2 +- Clocker/Menu Bar/StatusItemHandler.swift | 2 +- Clocker/Overall App/DataStore.swift | 4 ++-- Clocker/Overall App/DateFormatterManager.swift | 14 +++++++------- Clocker/Overall App/Logger.swift | 2 +- Clocker/Overall App/NetworkManager.swift | 2 +- .../Panel/Data Layer/TimezoneDataOperations.swift | 4 ++-- Clocker/Panel/FloatingWindowController.swift | 2 +- Clocker/Panel/Notes Popover/NotesPopover.swift | 4 ++-- Clocker/Panel/PanelController.swift | 8 ++++---- Clocker/Panel/ParentPanelController.swift | 2 +- Clocker/Panel/UI/BackgroundPanelView.swift | 2 +- .../App Feedback/AppFeedbackWindowController.swift | 2 +- 15 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Clocker/Clocker/LocationController.swift b/Clocker/Clocker/LocationController.swift index 8161d79..295cb3a 100644 --- a/Clocker/Clocker/LocationController.swift +++ b/Clocker/Clocker/LocationController.swift @@ -12,7 +12,7 @@ class LocationController: NSObject { return locationManager }() - @objc class func sharedController() -> LocationController { + class func sharedController() -> LocationController { return sharedInstance } @@ -20,23 +20,23 @@ class LocationController: NSObject { return CLLocationManager.authorizationStatus() } - @objc func locationAccessNotDetermined() -> Bool { + func locationAccessNotDetermined() -> Bool { return CLLocationManager.authorizationStatus() == .notDetermined } - @objc func locationAccessGranted() -> Bool { + func locationAccessGranted() -> Bool { return CLLocationManager.authorizationStatus() == .authorizedAlways || CLLocationManager.authorizationStatus() == .authorized } - @objc func locationAccessDenied() -> Bool { + func locationAccessDenied() -> Bool { return CLLocationManager.authorizationStatus() == .restricted || CLLocationManager.authorizationStatus() == .denied } - @objc func setDelegate() { + func setDelegate() { locationManager.delegate = self } - @objc func determineAndRequestLocationAuthorization() { + func determineAndRequestLocationAuthorization() { setDelegate() if CLLocationManager.locationServicesEnabled() { diff --git a/Clocker/Events and Reminders/EventCenter.swift b/Clocker/Events and Reminders/EventCenter.swift index 287f30c..b6485a6 100644 --- a/Clocker/Events and Reminders/EventCenter.swift +++ b/Clocker/Events and Reminders/EventCenter.swift @@ -16,7 +16,7 @@ class EventCenter: NSObject { var filteredEvents: [Date: [EventInfo]] = [:] - @discardableResult @objc class func sharedCenter() -> EventCenter { + @discardableResult class func sharedCenter() -> EventCenter { return shared } diff --git a/Clocker/Menu Bar/MenubarHandler.swift b/Clocker/Menu Bar/MenubarHandler.swift index e96eefa..4e6854e 100644 --- a/Clocker/Menu Bar/MenubarHandler.swift +++ b/Clocker/Menu Bar/MenubarHandler.swift @@ -4,7 +4,7 @@ import Cocoa import EventKit class MenubarHandler: NSObject { - @objc func titleForMenubar() -> String? { + func titleForMenubar() -> String? { if let nextEvent = checkForUpcomingEvents() { return nextEvent } diff --git a/Clocker/Menu Bar/StatusItemHandler.swift b/Clocker/Menu Bar/StatusItemHandler.swift index 75a6fbe..ea50427 100644 --- a/Clocker/Menu Bar/StatusItemHandler.swift +++ b/Clocker/Menu Bar/StatusItemHandler.swift @@ -273,7 +273,7 @@ class StatusItemHandler: NSObject { updateMenubar() } - @objc func invalidateTimer(showIcon show: Bool, isSyncing sync: Bool) { + func invalidateTimer(showIcon show: Bool, isSyncing sync: Bool) { // Check if user is not showing // 1. Timezones // 2. Upcoming Event diff --git a/Clocker/Overall App/DataStore.swift b/Clocker/Overall App/DataStore.swift index 096d66c..38c7f23 100644 --- a/Clocker/Overall App/DataStore.swift +++ b/Clocker/Overall App/DataStore.swift @@ -24,7 +24,7 @@ class DataStore: NSObject { // Since this pref can accessed every second, let's cache this private var shouldDisplayDateInMenubar: Bool = false - @objc class func shared() -> DataStore { + class func shared() -> DataStore { return sharedStore } @@ -34,7 +34,7 @@ class DataStore: NSObject { shouldDisplayDateInMenubar = shouldDisplay(.dayInMenubar) } - @objc func timezones() -> [Data] { + func timezones() -> [Data] { guard let preferences = userDefaults.object(forKey: CLDefaultPreferenceKey) as? [Data] else { return [] } diff --git a/Clocker/Overall App/DateFormatterManager.swift b/Clocker/Overall App/DateFormatterManager.swift index d62b2b1..d1df9ae 100644 --- a/Clocker/Overall App/DateFormatterManager.swift +++ b/Clocker/Overall App/DateFormatterManager.swift @@ -14,7 +14,7 @@ class DateFormatterManager: NSObject { private static var gregorianCalendar = Calendar(identifier: Calendar.Identifier.gregorian) private static var USLocale = Locale(identifier: "en_US") - @objc class func dateFormatter(with style: DateFormatter.Style, for timezoneIdentifier: String) -> DateFormatter { + class func dateFormatter(with style: DateFormatter.Style, for timezoneIdentifier: String) -> DateFormatter { dateFormatter.dateStyle = style dateFormatter.timeStyle = style dateFormatter.locale = USLocale @@ -22,7 +22,7 @@ class DateFormatterManager: NSObject { return dateFormatter } - @objc class func dateFormatterWithCalendar(with style: DateFormatter.Style) -> DateFormatter { + class func dateFormatterWithCalendar(with style: DateFormatter.Style) -> DateFormatter { calendarDateFormatter.dateStyle = style calendarDateFormatter.timeStyle = style calendarDateFormatter.locale = USLocale @@ -30,14 +30,14 @@ class DateFormatterManager: NSObject { return calendarDateFormatter } - @objc class func simpleFormatter(with style: DateFormatter.Style) -> DateFormatter { + class func simpleFormatter(with style: DateFormatter.Style) -> DateFormatter { simpleFormatter.dateStyle = style simpleFormatter.timeStyle = style simpleFormatter.locale = USLocale return simpleFormatter } - @objc class func dateFormatterWithFormat(with style: DateFormatter.Style, format: String, timezoneIdentifier: String, locale: Locale = Locale(identifier: "en_US")) -> DateFormatter { + class func dateFormatterWithFormat(with style: DateFormatter.Style, format: String, timezoneIdentifier: String, locale: Locale = Locale(identifier: "en_US")) -> DateFormatter { specializedFormatter.dateStyle = style specializedFormatter.timeStyle = style specializedFormatter.dateFormat = format @@ -46,7 +46,7 @@ class DateFormatterManager: NSObject { return specializedFormatter } - @objc class func localizedFormatter(with format: String, for timezoneIdentifier: String, locale _: Locale = Locale.autoupdatingCurrent) -> DateFormatter { + class func localizedFormatter(with format: String, for timezoneIdentifier: String, locale _: Locale = Locale.autoupdatingCurrent) -> DateFormatter { dateFormatter.dateStyle = .none dateFormatter.timeStyle = .none dateFormatter.locale = Locale.autoupdatingCurrent @@ -55,7 +55,7 @@ class DateFormatterManager: NSObject { return dateFormatter } - @objc class func localizedCalendaricalDateFormatter(with format: String) -> DateFormatter { + class func localizedCalendaricalDateFormatter(with format: String) -> DateFormatter { calendarDateFormatter.dateStyle = .none calendarDateFormatter.timeStyle = .none calendarDateFormatter.locale = Locale.autoupdatingCurrent @@ -64,7 +64,7 @@ class DateFormatterManager: NSObject { return calendarDateFormatter } - @objc class func localizedSimpleFormatter(_ format: String) -> DateFormatter { + class func localizedSimpleFormatter(_ format: String) -> DateFormatter { localizedSimpleFormatter.dateStyle = .none localizedSimpleFormatter.timeStyle = .none localizedSimpleFormatter.dateFormat = format diff --git a/Clocker/Overall App/Logger.swift b/Clocker/Overall App/Logger.swift index dcc0417..691567b 100644 --- a/Clocker/Overall App/Logger.swift +++ b/Clocker/Overall App/Logger.swift @@ -6,7 +6,7 @@ import os.log import os.signpost class Logger: NSObject { - @objc class func log(object: [String: Any], for key: NSString) { + class func log(object: [String: Any], for key: NSString) { Answers.logCustomEvent(withName: key as String, customAttributes: object) } diff --git a/Clocker/Overall App/NetworkManager.swift b/Clocker/Overall App/NetworkManager.swift index 09d3dd1..0f5516f 100644 --- a/Clocker/Overall App/NetworkManager.swift +++ b/Clocker/Overall App/NetworkManager.swift @@ -32,7 +32,7 @@ class NetworkManager: NSObject { }() } -@objc extension NetworkManager { +extension NetworkManager { @discardableResult class func task(with path: String, completionHandler: @escaping (_ response: Data?, _ error: NSError?) -> Void) -> URLSessionDataTask? { let configuration = URLSessionConfiguration.default diff --git a/Clocker/Panel/Data Layer/TimezoneDataOperations.swift b/Clocker/Panel/Data Layer/TimezoneDataOperations.swift index 353e71e..1c13c55 100644 --- a/Clocker/Panel/Data Layer/TimezoneDataOperations.swift +++ b/Clocker/Panel/Data Layer/TimezoneDataOperations.swift @@ -9,7 +9,7 @@ class TimezoneDataOperations: NSObject { private static var gregorianCalendar = NSCalendar(calendarIdentifier: NSCalendar.Identifier.gregorian) private static var swiftyCalendar = Calendar(identifier: .gregorian) - @objc init(with timezone: TimezoneData) { + init(with timezone: TimezoneData) { dataObject = timezone } } @@ -318,7 +318,7 @@ extension TimezoneDataOperations { return dateFormatter.string(from: Date()) } - @objc func saveObject(at index: Int = -1) { + func saveObject(at index: Int = -1) { var defaults = DataStore.shared().timezones() let encodedObject = NSKeyedArchiver.archivedData(withRootObject: dataObject as Any) index == -1 ? defaults.append(encodedObject) : defaults.insert(encodedObject, at: index) diff --git a/Clocker/Panel/FloatingWindowController.swift b/Clocker/Panel/FloatingWindowController.swift index 1f1063d..512155a 100644 --- a/Clocker/Panel/FloatingWindowController.swift +++ b/Clocker/Panel/FloatingWindowController.swift @@ -123,7 +123,7 @@ class FloatingWindowController: ParentPanelController { window?.backgroundColor = NSColor.clear } - @objc func startWindowTimer() { + func startWindowTimer() { repeater = Repeater(interval: .seconds(1), mode: .infinite) { _ in OperationQueue.main.addOperation { self.updateTime() diff --git a/Clocker/Panel/Notes Popover/NotesPopover.swift b/Clocker/Panel/Notes Popover/NotesPopover.swift index 59ece65..4f9de6b 100644 --- a/Clocker/Panel/Notes Popover/NotesPopover.swift +++ b/Clocker/Panel/Notes Popover/NotesPopover.swift @@ -449,7 +449,7 @@ class NotesPopover: NSViewController { } } -@objc extension NotesPopover { +extension NotesPopover { func setRow(row: Int) { currentRow = row } @@ -462,7 +462,7 @@ class NotesPopover: NSViewController { self.popover = popover } - func themeChanged() { + @objc func themeChanged() { notesTextView.textColor = Themer.shared().mainTextColor() customLabel.textColor = Themer.shared().mainTextColor() reminderPicker.textColor = Themer.shared().mainTextColor() diff --git a/Clocker/Panel/PanelController.swift b/Clocker/Panel/PanelController.swift index 4bb3d5c..cbab950 100644 --- a/Clocker/Panel/PanelController.swift +++ b/Clocker/Panel/PanelController.swift @@ -13,7 +13,7 @@ class PanelController: ParentPanelController { super.windowDidLoad() } - @objc class func shared() -> PanelController { + class func shared() -> PanelController { return sharedWindow } @@ -49,7 +49,7 @@ class PanelController: ParentPanelController { } } - @objc override func updateDefaultPreferences() { + override func updateDefaultPreferences() { super.updateDefaultPreferences() } @@ -264,7 +264,7 @@ class PanelController: ParentPanelController { setActivePanel(newValue: false) } - @objc func hasActivePanelGetter() -> Bool { + func hasActivePanelGetter() -> Bool { return hasActivePanel } @@ -294,7 +294,7 @@ class PanelController: ParentPanelController { datasource = nil } - @objc func setActivePanel(newValue: Bool) { + func setActivePanel(newValue: Bool) { hasActivePanel = newValue hasActivePanel ? open() : minimize() } diff --git a/Clocker/Panel/ParentPanelController.swift b/Clocker/Panel/ParentPanelController.swift index dbf1bfa..12520f1 100644 --- a/Clocker/Panel/ParentPanelController.swift +++ b/Clocker/Panel/ParentPanelController.swift @@ -407,7 +407,7 @@ class ParentPanelController: NSWindowController { } } - @objc func updateDefaultPreferences() { + func updateDefaultPreferences() { if #available(OSX 10.14, *) { PerfLogger.startMarker("Update Default Preferences") } diff --git a/Clocker/Panel/UI/BackgroundPanelView.swift b/Clocker/Panel/UI/BackgroundPanelView.swift index 02f0956..739b413 100644 --- a/Clocker/Panel/UI/BackgroundPanelView.swift +++ b/Clocker/Panel/UI/BackgroundPanelView.swift @@ -57,7 +57,7 @@ class BackgroundPanelView: NSView { return true } - @objc func setArrowX(value: CGFloat) { + func setArrowX(value: CGFloat) { arrowX = value setNeedsDisplay(bounds) } diff --git a/Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift b/Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift index 718db0f..417e24c 100644 --- a/Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift +++ b/Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift @@ -83,7 +83,7 @@ class AppFeedbackWindowController: NSWindowController { } } - @objc class func shared() -> AppFeedbackWindowController { + class func shared() -> AppFeedbackWindowController { return sharedWindow }