This class uses Alamofire, the Swift equivalent of AFNetworking, the most used third-party library to help handle network communications in iOS. This class also uses SwiftyJson, which eliminates the problem of the nested checks for optionals during the decoding of JSON (short for JavaScript Object Notation, a lightweight data interchange format) data:
import Foundation import CoreLocation import Alamofire import SwiftyJSON class WeatherDatastore { func retrieveCurrentWeatherAtLat(lat: CLLocationDegrees, lon: CLLocationDegrees, block: (weatherCondition: WeatherCondition) -> Void) { } func retrieveHourlyForecastAtLat(lat: CLLocationDegrees, lon: CLLocationDegrees, block: (weatherConditions: Array<WeatherCondition>) -> Void) { } func retrieveDailyForecastAtLat(lat: Double, lon: Double, dayCnt: Int, block: (weatherConditions: Array<WeatherCondition>) -> Void) { } ...