Skip to content

Instantly share code, notes, and snippets.

@salverde
Created February 8, 2017 04:57
Show Gist options
  • Save salverde/bbbdbae5a99017bc434c6d2c7f0120ad to your computer and use it in GitHub Desktop.
Save salverde/bbbdbae5a99017bc434c6d2c7f0120ad to your computer and use it in GitHub Desktop.
UnboxedAlamofire snippet
let url = apiBaseURL + "/abusers.json"
Alamofire.request(url, method: .get, parameters: params, encoding: URLEncoding.default).validate(statusCode: 200..<300).responseObject { (response: DataResponse<Abuser>) in
switch response.result {
case .success(let searchResult):
completion?(searchResult)
case .failure(let error):
print("error: \(error)")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment