Skip to content

flexaddicted/FirebaseRemoteConfigDecoder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

A custom decoder for decoding RemoteConfig from Firebase. Work in progress!

Usage

Declare a simple struct that conforms to Decodable protocol.

struct AppRemoteConfig: Decodable {
    
    enum MyEnum: Int, Decodable {
        case none
        case update
    }

    let myEnum: MyEnum
    let myUrl: URL
    let myString: String
    let myBool: Bool?
    let myInt: Int // Float or Double as well

    enum CodingKeys: String, CodingKey {
        case myUrl = "my_url"
        case myString = "my_string"
        case myBool
        case myInt
        case myEnum = "my_enum"
    }
}

Once done, use FirebaseRemoteConfigDecoder as follows:

let decoder = FirebaseRemoteConfigDecoder()
let decoded = try? decoder.decode(AppRemoteConfig.self, from: self.remoteConfig)    

Roadmap

In the roadmap:

  • [] improve the documentation;
  • [] support more data types (e.g. Date);
  • [] ship with CocoaPods or Carthage;
  • [] integrate Unit Tests.

About

A custom decoder for decoding Firebase RemoteConfig

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages