Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/101.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios +;=生产';()';,不是预期的上下文结果类型UInt_Ios_Swift_Swift3_Xcode8 - Fatal编程技术网

Ios +;=生产';()';,不是预期的上下文结果类型UInt

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

我正在将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 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
}
}
}