Currently, I create a generic list as follows:
List {
ForEach(viewModel.categoryItems) { category in
Text("\(category.category)")
}.onMove { indexSet, newOffset in
viewModel.categoryItems.move(fromOffsets: indexSet, toOffset: newOffset)
}
}.toolbar {
ToolbarItem {
if viewModel.categoryItems.count > 0 {
EditButton()
}
}
}
I would like to be able to number this list and also have those numbers change on move (2 becomes 1 if moved into the 1 place).