1

I would like to make my list in a form editable and sortable with the editMode. I've already tried using .environment(.editMode, .constant(.active)) on the list or on the ForEach loop, but unfortunately that didn't work. I'm happy about help.

What I want:

https://youtube.com/shorts/vSE6g-NVuE4?feature=share

Current code:

                        Form {
                            ForEach(elements, id: \.id) { element in
                                Text(element.name)
                            }
                            .onMove(perform: { _, _ in
                                
                            })
                            .onDelete(perform: { _ in
                                
                            })
                            .listRowSeparator(.hidden, edges: .bottom)
                            .environment(\.editMode, .constant(.active))
                        }
SwiftUI_Max
  • 201
  • 2
  • 6
  • 1
    Does this answer your question https://stackoverflow.com/a/63518487/12299030? – Asperi May 10 '22 at 18:06
  • 1
    Does this answer your question? [SwiftUI EditButton() does not work when set editMode in NavigationLink](https://stackoverflow.com/questions/65936588/swiftui-editbutton-does-not-work-when-set-editmode-in-navigationlink) – Yrb May 10 '22 at 18:16

0 Answers0