以下是代码:
var URLRequest: NSURLRequest {
let (path: String, parameters: [String: AnyObject]) = {
//Error: expected ',' seperator
//Error: expected pattern
switch self {
//Three cases here.
}
}()
let URL = NSURL(string: Router.baseURLString)
let URLRequest = NSURLRequest(URL: URL!.URLByAppendingPathComponent(path))
//Error: use of unresolved identifier 'path'
let encoding = Alamofire.ParameterEncoding.URL
return encoding.encode(URLRequest, parameters: parameters).0
//Error: use of unresolved identifier 'parameters'
}
显示了几个错误,但我认为所有错误都是由同一问题引起的。 代码升级到Swift 2.