Skip to content

Instantly share code, notes, and snippets.

@alexiscreuzot
Created December 25, 2015 23:18
Show Gist options
  • Save alexiscreuzot/0e12a2e2a4f2174d5729 to your computer and use it in GitHub Desktop.
Save alexiscreuzot/0e12a2e2a4f2174d5729 to your computer and use it in GitHub Desktop.
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