问题
Here's the code:
extension Alamofire.Request {
public func responseObject<T: ResponseJSONObjectSerializable> (completionHandler: (NSURLRequest?, NSHTTPURLResponse?, Result<T> -> Void) -> Self {
//Error1: expected ',' separator
//Error2: expected parameter type following ':'
...
)
}
I'm using Swift 2.0, Alamofire 3.0, and SwiftyJSON.
回答1:
Problem solved: there's a mistake of parenthesis in the code, the )
should be place behind result<T>
rather than the end of the function.
I thought it was some serious problem, took me a long time to find this. :P
来源:https://stackoverflow.com/questions/33010256/defining-function-error-using-generics