ConfigurationSwitcher
public class ConfigurationSwitcher
ConfigurationSwitcher is a singleton that allows for environment/configuration switching when working with staging/production environments. Selections are persistent across sessions and can be updated on the fly.
-
Getter/Setter for the current
ServerConfigurationidentity. When setting this value it will write toUserDefaultsusing thedefaultsKeyvalue as the key.Complexity
O(1)
Declaration
Swift
public var configuration: String { get set }Return Value
A string value representing the indetity of the currently selected
ServerConfiguration -
Getter for the current
ServerConfigurationenvironment variables.Complexity
O(1)
Declaration
Swift
public var environmentVariables: [String : String] { get }Return Value
A dictionary value representing the identity of the currently selected
ServerConfiguration -
Setter for a given
ServerConfigurationobject. Must use this setter asConfigurationSwitcher.init()is markedinternalfor API purposes. Calling this function will remove all duplicateServerConfigurationobjects based on theidentifierthat is passed in.Complexity
O(n) where n is the number of
ServerConfigurationobjects inside theconfigurationsarray that have theidentifierDeclaration
Swift
public func configureEnvironment(withIdentifier identifier: String, variables: [String : String] = [:])Parameters
identifierThe name of the environment that the caller is attempting to set the value of.
variablesThe dictionary that the caller/client’s application has configured for this environment.
ConfigurationSwitcher Class Reference