-
-
Save Pasanpr/734884cb421cf904bb7f1c7d433bbf39 to your computer and use it in GitHub Desktop.
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
extension CurrentWeather: JSONDecodable { | |
init?(JSON: [String : AnyObject]) { | |
guard let temperature = JSON["temperature"] as? Double, | |
humidity = JSON["humidity"] as? Double, | |
precipitationProbability = JSON["precipProbability"] as? Double, | |
summary = JSON["summary"] as? String, | |
iconString = JSON["icon"] as? String else { | |
return nil | |
} | |
let icon = WeatherIcon(rawValue: iconString).image | |
self.temperature = temperature | |
self.humidity = humidity | |
self.precipitationProbability = precipitationProbability | |
self.summary = summary | |
self.icon = icon | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment