不知道足够先进的Swift来找出这个错误:
"功能产生预期类型'()&#39 ;;你的意思是用'()'?"
来称呼它public func generate() -> AnyGenerator <(String, JSON)> {
switch self.type {
case .Array:
let array_ = object as! [AnyObject]
var generate_ = array_.generate()
var index_: Int = 0
return AnyGenerator<(String, JSON)> { <-- this is the line with the error
if let element_: AnyObject = generate_.next() {
return ("\(index_++)", JSON(element_))
} else {
return nil
}
}
case .Dictionary:
let dictionary_ = object as! [String : AnyObject]
var generate_ = dictionary_.generate()
return AnyGenerator<(String, JSON)> {
if let (key_: String, value_: AnyObject) = generate_.next() {
return (key_, JSON(value_))
} else {
return nil
}
}
default:
return AnyGenerator<(String, JSON)> {
return nil
}
}
}