Skip to content

Instantly share code, notes, and snippets.

@macbaszii
Created August 17, 2016 07:44
Show Gist options
  • Save macbaszii/93a3c273890e2bd8221954feac64211b to your computer and use it in GitHub Desktop.
Save macbaszii/93a3c273890e2bd8221954feac64211b to your computer and use it in GitHub Desktop.
let URL = "https://raw.githubusercontent.com/tristanhimmelman/AlamofireObjectMapper/2ee8f34d21e8febfdefb2b3a403f18a43818d70a/sample_keypath_json"
let expectation = expectationWithDescription("\(URL)")
Alamofire.request(.GET, URL).responseObject(keyPath: "data") { (response: Response<WeatherResponse, NSError>) in
expectation.fulfill()
let weatherResponse = response.result.value
print(weatherResponse?.location)
if let threeDayForecast = weatherResponse?.threeDayForecast {
for forecast in threeDayForecast {
print(forecast.day)
print(forecast.temperature)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment