Browse Source

Update Foundation + Additions.swift

pull/92/head
Abhishek 4 years ago
parent
commit
27a609ac03
  1. 24
      Clocker/Overall App/Foundation + Additions.swift

24
Clocker/Overall App/Foundation + Additions.swift

@ -1,6 +1,7 @@
// Copyright © 2015 Abhishek Banthia // Copyright © 2015 Abhishek Banthia
import Cocoa import Cocoa
import CoreModelKit
extension NSNotification.Name { extension NSNotification.Name {
static let themeDidChange = NSNotification.Name("ThemeDidChangeNotification") static let themeDidChange = NSNotification.Name("ThemeDidChangeNotification")
@ -32,3 +33,26 @@ extension NSImage.Name {
static let sortToggleAlternateIcon = NSImage.Name("Additional Preferences Highlighted Dynamic") static let sortToggleAlternateIcon = NSImage.Name("Additional Preferences Highlighted Dynamic")
static let menubarIcon = NSImage.Name("LightModeIcon") static let menubarIcon = NSImage.Name("LightModeIcon")
} }
extension Data {
// Extracting this out for tests
public func decode() -> SearchResult? {
let jsonDecoder = JSONDecoder()
do {
let decodedObject = try jsonDecoder.decode(SearchResult.self, from: self)
return decodedObject
} catch {
return nil
}
}
public func decodeTimezone() -> Timezone? {
let jsonDecoder = JSONDecoder()
do {
let decodedObject = try jsonDecoder.decode(Timezone.self, from: self)
return decodedObject
} catch {
return nil
}
}
}

Loading…
Cancel
Save