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:
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?