Skip to content

Instantly share code, notes, and snippets.

@ahikmatf
Created October 13, 2016 10:12
Show Gist options
  • Save ahikmatf/1d3b8a9d26d0bb8d9d72d2747a14d226 to your computer and use it in GitHub Desktop.
Save ahikmatf/1d3b8a9d26d0bb8d9d72d2747a14d226 to your computer and use it in GitHub Desktop.
// http://stackoverflow.com/q/32371792/5552518
func authenticateUser(completionHandler: (responseObject: String?, error: NSError?) -> ()) {
makeAuthenticateUserCall(completionHandler)
}
func makeAuthenticateUserCall(completionHandler: (responseObject: String?, error: NSError?) -> ()) {
Alamofire.request(.GET, loginUrlString)
.authenticate(user: "a", password: "b")
.responseString { request, response, responseString, responseError in
completionHandler(responseObject: responseString as String!, error: responseError)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment