In my SwiftUI app, I have a list of items.
I\'m using the array of MenuItems to fill in the list
struct MenuItem: Identifiable, Equatable {
This can be done using using .enumerated. For your MenuItem values it will be as follows
.enumerated
MenuItem
List { ForEach(Array(menuItems.enumerated()), id: \.1.id) { (index, textItem) in // do with `index` anything needed here Text(textItem.text) } }