I want to display a list of dynamic views and to show and hide an action row when I tap on a view in the list, so I used DisclosureGroup, but when I set a deletion action on the ForEach that contains the list of disclosure groups, it sets the deletion action on the children also, how can I set the deletion action only on the disclosure group label, without its contents?
import SwiftUI
struct ContentView: View {
var body: some View {
List {
ForEach(0 ..< 10) { number in
DisclosureGroup {
Button("Action") {}
} label: {
Text("\(number)")
}
}
.onDelete { _ in }
}
}
}
