-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Feature proposal
- Firebase Component: RemoteConfig
struct Configuration: Codable {
var signinMethods: [String]
}
Decoder
Would be great to have a Decoder like Firestore.Decoder
to do something like this:
let remoteConfig = RemoteConfig.remoteConfig()
let decoder = RemoteConfig.Decoder()
let configuration = try! decoder.decode(Configuration.self, from: remoteConfig)
RemoteConfig.Decoder
should be able to decode 'RemoteConfigValue' as well:
let remoteConfigValue = RemoteConfig.remoteConfig().configValue(forKey: "authentication")
let decoder = RemoteConfig.Decoder()
let configuration = try! decoder.decode(Configuration.self, from: remoteConfigValue)
Encoder
Would be great to have also an Encoder to set defaults:
let remoteConfig = RemoteConfig.remoteConfig()
let configuration = Configuration(signiInMethods: ["email"])
let encoder = RemoteConfig.Encoder()
let defaults = try! encoder.encode(configuration)
remoteConfig.setDefaults(defaults)
or better, like for Firestore ref.setValue(from: Encodable)
let remoteConfig = RemoteConfig.remoteConfig()
let configuration = Configuration(signiInMethods: ["email"])
try! remoteConfig.setDefaults(from: configuration)