Reputation: 3255
I try to make a request to my server getting info form my API. Therefore I do:
Alamofire.request(.GET, requestURL).responseData { (response:NSHTTPURLResponse?, error: NSError?) -> Void in
print(response)
}
But I receive the error `Tuple pattern cannot match value of the non-tuple type 'Response'
Do I use the method in a wrong way?
The autocomplete shows me this:
Alamofire.request(.GET, requestURL).responseData(completionHandler: Response <NSData, NSError> -> void)
Upvotes: 0
Views: 294
Reputation: 1249
You can get the result from the Result type
in Alamofire 3. You could unwrap it with switch-case
by pattern matching, show you a example:
Alamofire.request(.GET, requestURL).responseData { (response) -> Void in
switch response.result {
case .Success(let data):
// Here you go
print(data)
case .Failure(let error):
// Error handle
print(error)
}
}
Upvotes: 3