Skip to content

Instantly share code, notes, and snippets.

@cmoulton
cmoulton / Simple Alamofire Calls in Swift 4
Last active December 8, 2020 09:29
Simple Alamofire Calls in Swift 4
import Alamofire
func makeGetCallWithAlamofire() {
let todoEndpoint: String = "https://jsonplaceholder.typicode.com/todos/1"
Alamofire.request(todoEndpoint)
.responseJSON { response in
// check for errors
guard response.result.error == nil else {
// got an error in getting the data, need to handle it
print("error calling GET on /todos/1")