C 样式用于对 Swift 3 的声明



我坚持使用这条简单的行,但无法将其从 Swift 2 转换为 Swift 3。

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

这可以替换为while循环

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

最新更新