Config Key
-
ConfigKey
ConfigKey is a key class specialized with
ValueType
for Remote Config It allows you to get value as a type ofValueType
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 aConfigKey
ofDecodable
orCodable
, Please useDecodableConfigKey
orCodableConfigKey
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 defineConfigKey
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