Удаление из массива во время перечисления в Swift?IOS

Программируем под IOS
Гость
Удаление из массива во время перечисления в Swift?

Сообщение Гость »


I want to enumerate through an array in Swift, and remove certain items. I'm wondering if this is safe to do, and if not, how I'm supposed to achieve this.

Currently, I'd be doing this:

Код: Выделить всё

for (index, aString: String) in enumerate(array) {
//Some of the strings...
array.removeAtIndex(index)
}


Источник: https://stackoverflow.com/questions/283 ... n-in-swift

Вернуться в «IOS»