Replacement for C-style loop in Swift 2.2

Although it’s not as “pretty”, you can use stride:

for var i in 0.stride(to: -1, by: -1) {
    print(i)
}

Leave a Comment