Here is the code I have currently:
@Query private var locations: [Location]
ForEach(locations) { location in
LocationListRowView(location: location)
}
.onDelete(perform: { indexSet in
for index in indexSet {
context.delete(locations[index])
}
})
.onMove(perform: move)
func move(from source: IndexSet, to destination: Int) {
locations.move(fromOffsets: source, toOffset: destination)
}
The error comes up on the line in the move function.
Topic:
Programming Languages
SubTopic:
Swift
Tags: