Don't create a new instance of userdefaults each time it is used.
This commit is contained in:
parent
7378616d26
commit
524a7383ac
|
@ -10,11 +10,11 @@ import UIKit
|
||||||
|
|
||||||
struct AppDefaults {
|
struct AppDefaults {
|
||||||
|
|
||||||
static var shared: UserDefaults {
|
static var shared: UserDefaults = {
|
||||||
let appIdentifierPrefix = Bundle.main.object(forInfoDictionaryKey: "AppIdentifierPrefix") as! String
|
let appIdentifierPrefix = Bundle.main.object(forInfoDictionaryKey: "AppIdentifierPrefix") as! String
|
||||||
let suiteName = "\(appIdentifierPrefix)group.\(Bundle.main.bundleIdentifier!)"
|
let suiteName = "\(appIdentifierPrefix)group.\(Bundle.main.bundleIdentifier!)"
|
||||||
return UserDefaults.init(suiteName: suiteName)!
|
return UserDefaults.init(suiteName: suiteName)!
|
||||||
}
|
}()
|
||||||
|
|
||||||
struct Key {
|
struct Key {
|
||||||
static let lastImageCacheFlushDate = "lastImageCacheFlushDate"
|
static let lastImageCacheFlushDate = "lastImageCacheFlushDate"
|
||||||
|
|
Loading…
Reference in New Issue