Downloading the background image
Before moving on to downloading the actual forecast, we'll introduce the topic of networking downloading a geo-localized background image.
Searching in Flickr
To get an image, we'll use the API of Flickr, a famous image-hosting website, using a convenient Pod. First of all, we override the viewWillAppear
function in PrettyWeatherApp
so that a new image will be downloaded every time View Controller appears:
override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) let lat:Double = 48.8567 let lon:Double = 2.3508 FlickrDatastore().retrieveImageAtLat(lat, lon: lon){ image in self.render(image) } }
To implement the searching feature, we set a dummy value using the coordinates of Paris. Then, we create ...
Get Swift: Developing iOS Applications now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.