Created
October 12, 2020 16:16
-
-
Save olivaresf/a7589e7e88e3bdf1788561c2c95af642 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class UserDefaultsStorage: Storage { | |
let modelVersion: String | |
let key: String | |
init(withKey: String, modelVersion: String) { | |
key = withKey | |
self.modelVersion = modelVersion | |
} | |
// Saving Settings bundle store, from cache. | |
func store(settingsBundle: SettingsBundle) { | |
var data = storedMigrationData | |
data.settingsBundle = settingsBundle | |
save(storedData: data) | |
} | |
// Loading of the settings bundle | |
func loadSettingsBundle() -> SettingsBundle { | |
storedMigrationData.settingsBundle | |
} | |
// Save onboarding bundle | |
func store(onboardingBundle: OnboardingBundle) { | |
var data = storedMigrationData | |
data.onboardingBundle = onboardingBundle | |
save(storedData: data) | |
} | |
// Loading onboarding bundle | |
func loadOnboardingBundle() -> OnboardingBundle { | |
storedMigrationData.onboardingBundle | |
} | |
private var storedDataCache: MigrationData? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment