From 6ae36303de4c10f20543baf8df5d60d0fe3eb30c Mon Sep 17 00:00:00 2001 From: Maurice Parker Date: Tue, 15 Oct 2019 09:11:18 -0500 Subject: [PATCH] Instantiate user defaults on each use to see if it helps the hanging issue --- iOS/AppDefaults.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/iOS/AppDefaults.swift b/iOS/AppDefaults.swift index d5ddda7a1..81a58a09c 100644 --- a/iOS/AppDefaults.swift +++ b/iOS/AppDefaults.swift @@ -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"