Don't create a new instance of userdefaults each time it is used.

This commit is contained in:
Maurice Parker 2019-11-04 11:35:45 -06:00
parent 7378616d26
commit 524a7383ac
1 changed files with 2 additions and 2 deletions

View File

@ -10,11 +10,11 @@ import UIKit
struct AppDefaults {
static var shared: UserDefaults {
static var shared: UserDefaults = {
let appIdentifierPrefix = Bundle.main.object(forInfoDictionaryKey: "AppIdentifierPrefix") as! String
let suiteName = "\(appIdentifierPrefix)group.\(Bundle.main.bundleIdentifier!)"
return UserDefaults.init(suiteName: suiteName)!
}
}()
struct Key {
static let lastImageCacheFlushDate = "lastImageCacheFlushDate"