Browse Source

Removing unneccesary @objc annotations.

pull/92/head
Abhishek 6 years ago
parent
commit
40b3a5a146
  1. 12
      Clocker/Clocker/LocationController.swift
  2. 2
      Clocker/Events and Reminders/EventCenter.swift
  3. 2
      Clocker/Menu Bar/MenubarHandler.swift
  4. 2
      Clocker/Menu Bar/StatusItemHandler.swift
  5. 4
      Clocker/Overall App/DataStore.swift
  6. 14
      Clocker/Overall App/DateFormatterManager.swift
  7. 2
      Clocker/Overall App/Logger.swift
  8. 2
      Clocker/Overall App/NetworkManager.swift
  9. 4
      Clocker/Panel/Data Layer/TimezoneDataOperations.swift
  10. 2
      Clocker/Panel/FloatingWindowController.swift
  11. 4
      Clocker/Panel/Notes Popover/NotesPopover.swift
  12. 8
      Clocker/Panel/PanelController.swift
  13. 2
      Clocker/Panel/ParentPanelController.swift
  14. 2
      Clocker/Panel/UI/BackgroundPanelView.swift
  15. 2
      Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift

12
Clocker/Clocker/LocationController.swift

@ -12,7 +12,7 @@ class LocationController: NSObject {
return locationManager return locationManager
}() }()
@objc class func sharedController() -> LocationController { class func sharedController() -> LocationController {
return sharedInstance return sharedInstance
} }
@ -20,23 +20,23 @@ class LocationController: NSObject {
return CLLocationManager.authorizationStatus() return CLLocationManager.authorizationStatus()
} }
@objc func locationAccessNotDetermined() -> Bool { func locationAccessNotDetermined() -> Bool {
return CLLocationManager.authorizationStatus() == .notDetermined return CLLocationManager.authorizationStatus() == .notDetermined
} }
@objc func locationAccessGranted() -> Bool { func locationAccessGranted() -> Bool {
return CLLocationManager.authorizationStatus() == .authorizedAlways || CLLocationManager.authorizationStatus() == .authorized return CLLocationManager.authorizationStatus() == .authorizedAlways || CLLocationManager.authorizationStatus() == .authorized
} }
@objc func locationAccessDenied() -> Bool { func locationAccessDenied() -> Bool {
return CLLocationManager.authorizationStatus() == .restricted || CLLocationManager.authorizationStatus() == .denied return CLLocationManager.authorizationStatus() == .restricted || CLLocationManager.authorizationStatus() == .denied
} }
@objc func setDelegate() { func setDelegate() {
locationManager.delegate = self locationManager.delegate = self
} }
@objc func determineAndRequestLocationAuthorization() { func determineAndRequestLocationAuthorization() {
setDelegate() setDelegate()
if CLLocationManager.locationServicesEnabled() { if CLLocationManager.locationServicesEnabled() {

2
Clocker/Events and Reminders/EventCenter.swift

@ -16,7 +16,7 @@ class EventCenter: NSObject {
var filteredEvents: [Date: [EventInfo]] = [:] var filteredEvents: [Date: [EventInfo]] = [:]
@discardableResult @objc class func sharedCenter() -> EventCenter { @discardableResult class func sharedCenter() -> EventCenter {
return shared return shared
} }

2
Clocker/Menu Bar/MenubarHandler.swift

@ -4,7 +4,7 @@ import Cocoa
import EventKit import EventKit
class MenubarHandler: NSObject { class MenubarHandler: NSObject {
@objc func titleForMenubar() -> String? { func titleForMenubar() -> String? {
if let nextEvent = checkForUpcomingEvents() { if let nextEvent = checkForUpcomingEvents() {
return nextEvent return nextEvent
} }

2
Clocker/Menu Bar/StatusItemHandler.swift

@ -273,7 +273,7 @@ class StatusItemHandler: NSObject {
updateMenubar() updateMenubar()
} }
@objc func invalidateTimer(showIcon show: Bool, isSyncing sync: Bool) { func invalidateTimer(showIcon show: Bool, isSyncing sync: Bool) {
// Check if user is not showing // Check if user is not showing
// 1. Timezones // 1. Timezones
// 2. Upcoming Event // 2. Upcoming Event

4
Clocker/Overall App/DataStore.swift

@ -24,7 +24,7 @@ class DataStore: NSObject {
// Since this pref can accessed every second, let's cache this // Since this pref can accessed every second, let's cache this
private var shouldDisplayDateInMenubar: Bool = false private var shouldDisplayDateInMenubar: Bool = false
@objc class func shared() -> DataStore { class func shared() -> DataStore {
return sharedStore return sharedStore
} }
@ -34,7 +34,7 @@ class DataStore: NSObject {
shouldDisplayDateInMenubar = shouldDisplay(.dayInMenubar) shouldDisplayDateInMenubar = shouldDisplay(.dayInMenubar)
} }
@objc func timezones() -> [Data] { func timezones() -> [Data] {
guard let preferences = userDefaults.object(forKey: CLDefaultPreferenceKey) as? [Data] else { guard let preferences = userDefaults.object(forKey: CLDefaultPreferenceKey) as? [Data] else {
return [] return []
} }

14
Clocker/Overall App/DateFormatterManager.swift

@ -14,7 +14,7 @@ class DateFormatterManager: NSObject {
private static var gregorianCalendar = Calendar(identifier: Calendar.Identifier.gregorian) private static var gregorianCalendar = Calendar(identifier: Calendar.Identifier.gregorian)
private static var USLocale = Locale(identifier: "en_US") 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.dateStyle = style
dateFormatter.timeStyle = style dateFormatter.timeStyle = style
dateFormatter.locale = USLocale dateFormatter.locale = USLocale
@ -22,7 +22,7 @@ class DateFormatterManager: NSObject {
return dateFormatter return dateFormatter
} }
@objc class func dateFormatterWithCalendar(with style: DateFormatter.Style) -> DateFormatter { class func dateFormatterWithCalendar(with style: DateFormatter.Style) -> DateFormatter {
calendarDateFormatter.dateStyle = style calendarDateFormatter.dateStyle = style
calendarDateFormatter.timeStyle = style calendarDateFormatter.timeStyle = style
calendarDateFormatter.locale = USLocale calendarDateFormatter.locale = USLocale
@ -30,14 +30,14 @@ class DateFormatterManager: NSObject {
return calendarDateFormatter return calendarDateFormatter
} }
@objc class func simpleFormatter(with style: DateFormatter.Style) -> DateFormatter { class func simpleFormatter(with style: DateFormatter.Style) -> DateFormatter {
simpleFormatter.dateStyle = style simpleFormatter.dateStyle = style
simpleFormatter.timeStyle = style simpleFormatter.timeStyle = style
simpleFormatter.locale = USLocale simpleFormatter.locale = USLocale
return simpleFormatter 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.dateStyle = style
specializedFormatter.timeStyle = style specializedFormatter.timeStyle = style
specializedFormatter.dateFormat = format specializedFormatter.dateFormat = format
@ -46,7 +46,7 @@ class DateFormatterManager: NSObject {
return specializedFormatter 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.dateStyle = .none
dateFormatter.timeStyle = .none dateFormatter.timeStyle = .none
dateFormatter.locale = Locale.autoupdatingCurrent dateFormatter.locale = Locale.autoupdatingCurrent
@ -55,7 +55,7 @@ class DateFormatterManager: NSObject {
return dateFormatter return dateFormatter
} }
@objc class func localizedCalendaricalDateFormatter(with format: String) -> DateFormatter { class func localizedCalendaricalDateFormatter(with format: String) -> DateFormatter {
calendarDateFormatter.dateStyle = .none calendarDateFormatter.dateStyle = .none
calendarDateFormatter.timeStyle = .none calendarDateFormatter.timeStyle = .none
calendarDateFormatter.locale = Locale.autoupdatingCurrent calendarDateFormatter.locale = Locale.autoupdatingCurrent
@ -64,7 +64,7 @@ class DateFormatterManager: NSObject {
return calendarDateFormatter return calendarDateFormatter
} }
@objc class func localizedSimpleFormatter(_ format: String) -> DateFormatter { class func localizedSimpleFormatter(_ format: String) -> DateFormatter {
localizedSimpleFormatter.dateStyle = .none localizedSimpleFormatter.dateStyle = .none
localizedSimpleFormatter.timeStyle = .none localizedSimpleFormatter.timeStyle = .none
localizedSimpleFormatter.dateFormat = format localizedSimpleFormatter.dateFormat = format

2
Clocker/Overall App/Logger.swift

@ -6,7 +6,7 @@ import os.log
import os.signpost import os.signpost
class Logger: NSObject { 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, Answers.logCustomEvent(withName: key as String,
customAttributes: object) customAttributes: object)
} }

2
Clocker/Overall App/NetworkManager.swift

@ -32,7 +32,7 @@ class NetworkManager: NSObject {
}() }()
} }
@objc extension NetworkManager { extension NetworkManager {
@discardableResult @discardableResult
class func task(with path: String, completionHandler: @escaping (_ response: Data?, _ error: NSError?) -> Void) -> URLSessionDataTask? { class func task(with path: String, completionHandler: @escaping (_ response: Data?, _ error: NSError?) -> Void) -> URLSessionDataTask? {
let configuration = URLSessionConfiguration.default let configuration = URLSessionConfiguration.default

4
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 gregorianCalendar = NSCalendar(calendarIdentifier: NSCalendar.Identifier.gregorian)
private static var swiftyCalendar = Calendar(identifier: .gregorian) private static var swiftyCalendar = Calendar(identifier: .gregorian)
@objc init(with timezone: TimezoneData) { init(with timezone: TimezoneData) {
dataObject = timezone dataObject = timezone
} }
} }
@ -318,7 +318,7 @@ extension TimezoneDataOperations {
return dateFormatter.string(from: Date()) return dateFormatter.string(from: Date())
} }
@objc func saveObject(at index: Int = -1) { func saveObject(at index: Int = -1) {
var defaults = DataStore.shared().timezones() var defaults = DataStore.shared().timezones()
let encodedObject = NSKeyedArchiver.archivedData(withRootObject: dataObject as Any) let encodedObject = NSKeyedArchiver.archivedData(withRootObject: dataObject as Any)
index == -1 ? defaults.append(encodedObject) : defaults.insert(encodedObject, at: index) index == -1 ? defaults.append(encodedObject) : defaults.insert(encodedObject, at: index)

2
Clocker/Panel/FloatingWindowController.swift

@ -123,7 +123,7 @@ class FloatingWindowController: ParentPanelController {
window?.backgroundColor = NSColor.clear window?.backgroundColor = NSColor.clear
} }
@objc func startWindowTimer() { func startWindowTimer() {
repeater = Repeater(interval: .seconds(1), mode: .infinite) { _ in repeater = Repeater(interval: .seconds(1), mode: .infinite) { _ in
OperationQueue.main.addOperation { OperationQueue.main.addOperation {
self.updateTime() self.updateTime()

4
Clocker/Panel/Notes Popover/NotesPopover.swift

@ -449,7 +449,7 @@ class NotesPopover: NSViewController {
} }
} }
@objc extension NotesPopover { extension NotesPopover {
func setRow(row: Int) { func setRow(row: Int) {
currentRow = row currentRow = row
} }
@ -462,7 +462,7 @@ class NotesPopover: NSViewController {
self.popover = popover self.popover = popover
} }
func themeChanged() { @objc func themeChanged() {
notesTextView.textColor = Themer.shared().mainTextColor() notesTextView.textColor = Themer.shared().mainTextColor()
customLabel.textColor = Themer.shared().mainTextColor() customLabel.textColor = Themer.shared().mainTextColor()
reminderPicker.textColor = Themer.shared().mainTextColor() reminderPicker.textColor = Themer.shared().mainTextColor()

8
Clocker/Panel/PanelController.swift

@ -13,7 +13,7 @@ class PanelController: ParentPanelController {
super.windowDidLoad() super.windowDidLoad()
} }
@objc class func shared() -> PanelController { class func shared() -> PanelController {
return sharedWindow return sharedWindow
} }
@ -49,7 +49,7 @@ class PanelController: ParentPanelController {
} }
} }
@objc override func updateDefaultPreferences() { override func updateDefaultPreferences() {
super.updateDefaultPreferences() super.updateDefaultPreferences()
} }
@ -264,7 +264,7 @@ class PanelController: ParentPanelController {
setActivePanel(newValue: false) setActivePanel(newValue: false)
} }
@objc func hasActivePanelGetter() -> Bool { func hasActivePanelGetter() -> Bool {
return hasActivePanel return hasActivePanel
} }
@ -294,7 +294,7 @@ class PanelController: ParentPanelController {
datasource = nil datasource = nil
} }
@objc func setActivePanel(newValue: Bool) { func setActivePanel(newValue: Bool) {
hasActivePanel = newValue hasActivePanel = newValue
hasActivePanel ? open() : minimize() hasActivePanel ? open() : minimize()
} }

2
Clocker/Panel/ParentPanelController.swift

@ -407,7 +407,7 @@ class ParentPanelController: NSWindowController {
} }
} }
@objc func updateDefaultPreferences() { func updateDefaultPreferences() {
if #available(OSX 10.14, *) { if #available(OSX 10.14, *) {
PerfLogger.startMarker("Update Default Preferences") PerfLogger.startMarker("Update Default Preferences")
} }

2
Clocker/Panel/UI/BackgroundPanelView.swift

@ -57,7 +57,7 @@ class BackgroundPanelView: NSView {
return true return true
} }
@objc func setArrowX(value: CGFloat) { func setArrowX(value: CGFloat) {
arrowX = value arrowX = value
setNeedsDisplay(bounds) setNeedsDisplay(bounds)
} }

2
Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift

@ -83,7 +83,7 @@ class AppFeedbackWindowController: NSWindowController {
} }
} }
@objc class func shared() -> AppFeedbackWindowController { class func shared() -> AppFeedbackWindowController {
return sharedWindow return sharedWindow
} }

Loading…
Cancel
Save