In SwiftUI how can I avoid having row content being indenting in my List when I move into Edit Mode, but not using onDelete? That is currently my row content is indented as this happens, as if the "delete" button will be shown on the left, however I'm not using onDelete so there is no button there.
Animated GIF
Code extract here:
var body: some View {
VStack{
List() {
ForEach(gcTasks) { gcTask in
HStack {
GCTaskRow(withGcTask: gcTask, haha: "")
}
}
// .onDelete(perform: self.deleteTask) // NOTE: HAVE REMOVED
.onMove(perform: self.move)
}
}
.environment(\.editMode, listInEditMode ? .constant(.active) : .constant(.inactive))
}
Background - Actually want to move to being in EDIT mode always, i.e. so always have the option of dragging row up/down, however will never use Delete hence want to review all traces of onDelete, in this case being the automatic indentation..
UPDATE: Another example (playgrounds) of how the unwanted indenting is occuring:
import SwiftUI
import PlaygroundSupport
let modelData: [String] = ["Eggs", "Milk", "Bread"]
struct ListTestNoDelete: View {
private func move(from uiStartIndexSet: IndexSet, to uiDestIndex: Int) {
print("On Move")
}
var body: some View {
NavigationView {
VStack {
List {
ForEach(modelData, id: \.self) { str in
Text(str)
}
.onMove(perform: self.move)
}
.environment(\.editMode, .constant(.active))
.navigationBarTitle( Text("Test") )
}
}
}
}
let listTest = ListTestNoDelete()
PlaygroundPage.current.liveView = UIHostingController(rootView: listTest)


