Skip to content

FR: Add RemoteConfig Decoder and Encoder #6883

@lorenzofiamingo

Description

@lorenzofiamingo

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)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions