5
Сопоставить или уменьшить с помощью индекса в Swift
Есть ли способ получить индекс массива в Swift mapили reduceв нем? Я ищу что-то вроде each_with_indexRuby. func lunhCheck(number : String) -> Bool { var odd = true; return reverse(number).map { String($0).toInt()! }.reduce(0) { odd = !odd return $0 + (odd ? ($1 == 9 ? 9 : ($1 * 2) …