C风格的声明,斯威夫特3

问题描述:

我坚持这个简单的线条,但不能从斯威夫特2转换为雨燕3.C风格的声明,斯威夫特3

for(index = indexes.lastIndex; 
    index != NSNotFound; 
    index = indexes.indexLessThanIndex(index)) 
{ 

} 
+1

你从哪种语言转换而来?原始代码是用Swift 2,C语言还是其他语言编写的? –

+0

从swift 2开始,谢谢 –

+1

https://github.com/apple/swift-evolution/blob/master/proposals/0007-remove-c-style-for-loops.md –

这可能与while

var index = indexes.lastIndex 
while index != NSNotFound { 
    // do something with index 
    index = indexes.indexLessThanIndex(index) 
} 
被替换