Swift 2 By Example by Giordano Scalzo

Swift 2 By Example by Giordano Scalzo

Author:Giordano Scalzo [Scalzo, Giordano]
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2016-03-13T23:00:00+00:00


Note

The code for the forecast can be found at http://openweathermap.org/weather-conditions.

Then, we change the viewWillAppear function in PrettyWeatherViewController again. We do this to raise three calls to get the current weather and forecast:

override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) locationDatastore = LocationDatastore() { [weak self] location in FlickrDatastore().retrieveImageAtLat(location.lat, lon: location.lon){ image in self?.render(image) return } let weatherDatastore = WeatherDatastore() weatherDatastore.retrieveCurrentWeatherAtLat(location.lat, lon: location.lon) { currentWeatherConditions in self?.renderCurrent(currentWeatherConditions) return } weatherDatastore.retrieveHourlyForecastAtLat(location.lat, lon: location.lon) { hourlyWeatherConditions in self?.renderHourly(hourlyWeatherConditions) return } weatherDatastore.retrieveDailyForecastAtLat(location.lat, lon: location.lon, dayCnt: 7) { hourlyWeatherConditions in self?.renderDaily(hourlyWeatherConditions) return } } }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.