Question : swift ui for loop high to low
Answered by : fancy-flatworm-7imy9ovj7bjb
for index in stride(from: 5, to: 1, by: -1) { print(index)
}
//prints 5, 4, 3, 2
for index in stride(from: 5, through: 1, by: -1) { print(index)
}
//prints 5, 4, 3, 2, 1
Source : https://stackoverflow.com/questions/24508592/how-to-iterate-for-loop-in-reverse-order-in-swift | Last Update : Wed, 15 Jun 22