April 2017
Intermediate to advanced
316 pages
9h 33m
English
To create a Todo item, we can call sendRequest function in our MasterViewController viewDidLoad() method to be sure that it is working:
let newRequest = TodoRequest(id: 1, name: "First request", description: "description", notes: "notes", completed: false) sendRequest(Alamofire.Method.POST, request: newRequest)
This should add a new Todo item to our backend.
Our sendRequest method is incomplete and it does not provide a call back to receive the data. Let's improve it:
func sendRequest(method: Alamofire.Method, request: RequestProtocol, completion: @escaping (_ responseData: AnyObject?, _ error: Error?) -> Void) { // Add Headers let headers = configureHeaders(request) // Fetch Request Alamofire.request(method, ...Read now
Unlock full access