Created
May 8, 2019 11:11
-
-
Save alexbaramilis/5063e74263373c80d65b47c06d1682f3 to your computer and use it in GitHub Desktop.
Air by Propeller's API forecast response with Decodable and CodingKeys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct PropellerForecastResponse: Decodable { | |
let properties: PropellerForecastProperties | |
} | |
struct PropellerForecastProperties: Decodable { | |
let risk: String // risk of adverse respiratory conditions: "high", "medium" or "low" | |
let probability: Double // probability of adverse respiratory conditions: ex. 0.4938... | |
} | |
// MARK: - CodingKeys | |
extension PropellerForecastProperties { | |
enum CodingKeys: String, CodingKey { | |
case risk = "code" | |
case probability = "value" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment