Save window state to user defaults. Issue #1852

This commit is contained in:
Maurice Parker
2020-03-05 17:42:17 -07:00
parent 7bc5a7946f
commit fc447121d6
3 changed files with 40 additions and 7 deletions

View File

@@ -18,6 +18,7 @@ struct AppDefaults {
struct Key {
static let firstRunDate = "firstRunDate"
static let windowState = "windowState"
static let lastImageCacheFlushDate = "lastImageCacheFlushDate"
static let sidebarFontSize = "sidebarFontSize"
static let timelineFontSize = "timelineFontSize"
@@ -55,6 +56,15 @@ struct AppDefaults {
return true
}()
static var windowState: [AnyHashable : Any]? {
get {
UserDefaults.standard.object(forKey: Key.windowState) as? [AnyHashable : Any]
}
set {
UserDefaults.standard.set(newValue, forKey: Key.windowState)
}
}
static var lastImageCacheFlushDate: Date? {
get {
return date(for: Key.lastImageCacheFlushDate)