Last active
November 28, 2019 11:19
-
-
Save albertodebortoli/693dc4b1b415682bf9399dae2e916f3a to your computer and use it in GitHub Desktop.
used by 'A Smart Feature Flagging System for iOS' article on Medium
This file contains hidden or 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
static let tweakManager: TweakManager = { | |
// mutable configuration (to override tweaks from other configurations) | |
let userDefaultsConfiguration = UserDefaultsConfiguration(userDefaults: .standard) | |
// remote configurations (optional) | |
let optimizelyConfiguration = OptimizelyConfiguration() | |
let firebaseConfiguration = FirebaseConfiguration() | |
// local JSON configuration (default tweaks) | |
let jsonFileURL = Bundle.main.url(forResource: "ExampleConfiguration", withExtension: "json")! | |
let localConfiguration = LocalConfiguration(jsonURL: jsonFileURL) | |
// priority is defined by the order in the configurations array (from highest to lowest) | |
let configurations: [Configuration] = [userDefaultsConfiguration, | |
optimizelyConfiguration, | |
firebaseConfiguration, | |
localConfiguration] | |
return TweakManager(configurations: configurations) | |
}() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment