April 2017
Intermediate to advanced
316 pages
9h 33m
English
We will create a file named WebServiceManager and add a function in it:
import Alamofire func sendRequest(method: Alamofire.Method, request: RequestProtocol) { // Add Headers let headers = configureHeaders(request) // Fetch Request Alamofire.request(method, "http://localhost:8080/todo/", headers: headers, encoding: .JSON) .validate() .responseJSON { response in if (response.result.error == nil) { debugPrint("HTTP Response Body: \(response.data)") } else { debugPrint("HTTP Request failed: \ (response.result.error)") } } } func configureHeaders(request: RequestProtocol) -> [String: String] { let listOfProperties = request.getPropertyNames() var configuredRequestHeaders = Dictionary<String, String>() for property ...Read now
Unlock full access