Editable Sections in SwiftUI List

I have a SwiftUI List with multiple Sections. Now I want to to move and delete whole Sections without but not the items within the section.
Currently I am doing the following:
Code Block swift
List {
ForEach(items) { item in
Section(header: Text(item.name)) {
Group {
NavigationLink("Item List", destination: ContentListView(item: item))
}
.deleteDisabled(true)
.moveDisabled(true)
      }
    }
  .onMove(perform: { indexSet, destination in
      items.move(fromOffsets: indexSet, toOffset: destination)
     })
.onDelete(perform: { indexSet in
    items.remove(atOffsets: indexSet)
     })
}
.listStyle(SidebarListStyle())


but with this I can not change anything.
Is this even possible with standard SwiftUI?

Replies

no, the edit functions on List are only applied to "rows" not Sections. Plus you can't move between sections