Created
December 25, 2015 23:18
-
-
Save alexiscreuzot/0e12a2e2a4f2174d5729 to your computer and use it in GitHub Desktop.
This file contains 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
public static func request( | |
endpoint: API.Endpoints, | |
completionHandler: Response<AnyObject, NSError> -> Void) | |
-> Request { | |
let request = Manager.sharedInstance.request( | |
endpoint.method, | |
endpoint.path, | |
parameters: endpoint.parameters, | |
encoding: .URL, | |
headers: nil | |
).responseJSON { response in | |
if (response.result.error) != nil { | |
DDLogError(response.result.error!.description) | |
completionHandler(response) | |
} else { | |
DDLogInfo(response.response!.description) | |
completionHandler(response) | |
} | |
} | |
DDLogInfo(request.description) | |
return request | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment