I am having exactly the same behavior with XCode Version 16.1 beta 2 (16B5014f). In the following code, onDelete is working, onMove is not and displays the same behavior as shown by the OP. "Move" is not printed and the display reverts to the original order after attempting to drag an item in Edit mode.
import MapKit
import SwiftData
import SwiftUI
struct WaypointList: View {
@Environment(\.modelContext) var modelContext
@Query(sort: \Location.latitude) var locations: [Location]
@State private var listSelection: Location?
@State private var searchResult = [Location]()
var body: some View {
NavigationSplitView {
List(selection: $listSelection) {
ForEach(searchResult) { location in
Text(location.name)
.tag(location)
}
.onMove(perform: move)
.onDelete {
print("Delete")
for index in $0 {
let item = searchResult[index]
let offset = locations.firstIndex(of: item)!
modelContext.delete(locations[offset])
searchResult.remove(at: index)
}
}
}
.frame(minWidth: 220)
.navigationTitle("Waypoints")
.toolbar {
EditButton()
}
} detail: {
if let selection = listSelection {
VStack {
LandmarkDetail(location: selection)
}
} else {
Text("Select a waypoint")
}
}
.onAppear {
searchResult = locations
}
}
func move(from source: IndexSet, to destination: Int) {
print("Move")
searchResult.move(fromOffsets: source, toOffset: destination)
}
}