Ios +;=生产';()';,不是预期的上下文结果类型UInt
我正在将swift 2.2迁移到swift 3.0,因为在swift 3中删除了++运算符。但是我在将i++转换为i+=1时遇到以下错误Ios +;=生产';()';,不是预期的上下文结果类型UInt,ios,swift,swift3,xcode8,Ios,Swift,Swift3,Xcode8,我正在将swift 2.2迁移到swift 3.0,因为在swift 3中删除了++运算符。但是我在将i++转换为i+=1时遇到以下错误 error:+= produces '()', not the expected contextual result type UInt 这是我的密码: public func makeIterator() -> AnyIterator<RLMObject> { var i: UInt = 0 return AnyIter
error:+= produces '()', not the expected contextual result type UInt
这是我的密码:
public func makeIterator() -> AnyIterator<RLMObject> {
var i: UInt = 0
return AnyIterator {
if (i >= self.count) {
return .none
} else {
return self[i += 1] as? RLMObject
}
}
}
public func makeIterator()->AnyIterator{
变量i:UInt=0
返回任意迭代器{
如果(i>=self.count){
返回,无
}否则{
将self[i+=1]返回为RLMObject
}
}
}