Config Key

  • ConfigKey

    ConfigKey is a key class specialized with ValueType for Remote Config It allows you to get value as a type of ValueType from Remote Config with subscription. That is, you don’t need to manually convert value to another type you want. You can handle the value to type safe.

    Example for getting value with ConfigKey:

    extension ConfigKeys {
        static let title = ConfigKey<String>("title")
    }
    
    let title = Lobster.shared[.title]
    print(String(describing: type(of: title))) // String
    

    Note

    If you want to define a ConfigKey of Decodable or Codable, Please use DecodableConfigKey or CodableConfigKey instead.

    Declaration

    Swift

    public final class ConfigKey<ValueType> : ConfigKeyBase<ValueType> where ValueType : ConfigSerializable
  • ConfigKeys

    ConfigKeys is just a class that gathers ConfigKey instances you define. You can define ConfigKey inside this class’s extension.

    Example for definition of ConfigKey:

    extension ConfigKeys {
        static let title = ConfigKey<String>("title")
        static let buttonColor = ConfigKey<UIColor>("button_color")
        static let experimentEnabled = ConfigKey<Bool>("experiment_enabled")
    }
    

    Declaration

    Swift

    public class ConfigKeys