DefaultsStore

public final class DefaultsStore

DefaultsStore

DefaultsStore is a value store class to sync default values with RemoteConfig.

You can set default value through Lobster’s subscripting.

Example for setting default value to DefaultsStore and syncing withRemoteConfig.

extension ConfigKeys {
    static let title = ConfigKey<String>("title")
}

// use subscripting
Lobster.shared[default: .title] = "foo bar"

// use dictionary
Lobster.shared.setDefaults([ConfigKeys.title._key: "foo bar"])

Note

Basically, You don’t have to use it directly.
  • A typealias of default values.

    Declaration

    Swift

    public typealias Defaults = [String : Any]
  • A subscripting

    Get a value or set a value with a key.

    Declaration

    Swift

    public subscript(key: String) -> Any? { get set }

    Parameters

    key

    A key.

  • Returns default values

    default values are converted from [String: Any] to [String: NSObject] before returning.

    Declaration

    Swift

    public var defaults: [String : NSObject] { get }
  • Set default values

    Basically, DefaultsStore try to merge new default values into existing default values.

    But If you want to overwrite default values, please pass merge: true parameter.

    Declaration

    Swift

    public func set(defaults: Defaults, merge: Bool = true)

    Parameters

    defaults

    default values

    merge

    A flag for deciding whether merge default values into existing values or not.

  • Clear existing default values.

    Declaration

    Swift

    public func clear()