I'm storing a list of a custom data type in a Core Data container and looping through them as such:
ForEach(coreDataViewModel.favoriteVerses) { verse in
VStack(alignment: .leading, spacing: 4) {
Text(verse.verse)
}
}
// how to save this order if user closes out of app?
.onMove(perform: { indices, newOffset in
coreDataViewModel.move(indices: indices, newOffset: newOffset)
})
The move functionality works fine, but after clicking done and exiting out of the app, the order reverts back to the original state.
// CoreDataViewModel
func move(indices: IndexSet, newOffset: Int) {
favoriteVerses.move(fromOffsets: indices, toOffset: newOffset)
}