Created
November 15, 2018 12:34
-
-
Save gmoraleda/7592102aed10726e1d9f50eb4460a19d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Alamofire.request(requestURL, method: .get, parameters: parameters, encoding: URLEncoding.default).responseData { response in | |
if let data = response.result.value { | |
let decoder = JSONDecoder() | |
do { | |
let apiResponse = try decoder.decode(ApiResponse.self, from: data) | |
// Do stuff | |
} catch { | |
NSLog("Error while decoding") | |
// Error handling | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment