How to iterate over an array in reverse order in Swift? For-in loop backwards
Hi everyone! I just started learning Swift and came across this task. I have an array of strings:
```swift
let fruits = ["apple", "banana", "orange", "grape"]
```
I need to output the elements of this array in reverse order, that is, starting with "grape" and ending with "apple". I know how to do a regular for-in loop:
```swift
for fruit in fruits {
print(fruit)
}
```
But this outputs the elements in order. I tried writing something like `for fruit in fruits.reversed()`, but I'm not sure if that's correct. I also heard that you can use an index and decrement it, but that looks cumbersome. Please tell me how to properly organize a loop to iterate over an array in reverse order? Are there several ways? And which one is considered the most "Swift-like" (idiomatic)? Thanks in advance!