Created
August 31, 2020 05:29
-
-
Save olivaresf/48d48199a7c8fa751b153177f3af90a0 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
typedef NS_ENUM(NSUInteger, Degrees) { | |
DegreesCelsius, | |
DegreesFahrenheit, | |
DegreesKelvin, | |
}; | |
- (NSString *)highestTemperatureForecasted:(WAForecastModel *)forecast degrees:(Degrees)type; | |
{ | |
WADayForecast *dailyForecast = forecast.dailyForecasts.firstObject; | |
CGFloat temperature; | |
switch (type) { | |
case DegreesCelsius: | |
temperature = dailyForecast.celsius; | |
break; | |
case DegreesFahrenheit: | |
temperature = dailyForecast.fahrenheit; | |
break; | |
case DegreesKelvin: | |
temperature = dailyForecast.kelvin; | |
break; | |
default: | |
return @"BAD TYPE"; | |
} | |
return [NSString stringWithFormat:@"%.0f°", temperature]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment