'SwiftUI list rown and buttons in same section in edit mode do not allow actions
SwiftUI list rown and buttons in same section in edit mode do not allow actions
Goal Would like to have clickable buttons in list and section, movable and deletable rows in list
code:
Section(header: Text("HEADER")) {
List {
ForEach(dataList) { data in
Button {
// action will not be called
print("action will not be called")
} label: {
Text("Button in list")
} // Button
} // ForEach
.onMove(perform: onMove)
} // List
Button {
// action will not be called
print("action will not be called")
} label: {
Text("Button in section")
}
} // Section
// .environment(\.editMode, .constant(.active))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
