2016-04-27 24 views
0

我堅持這個簡單的線條,但不能從斯威夫特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 –

回答

3

這可能與while

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