Instantiate user defaults on each use to see if it helps the hanging issue

This commit is contained in:
Maurice Parker 2019-10-15 09:11:18 -05:00
parent 51373885b4
commit 6ae36303de
1 changed files with 6 additions and 3 deletions

View File

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