Hi, I want to enable swipeActions for some rows of a List while other rows do not have this action.
Here is an example:
List {
ForEach(1..<100) { i in
Text("\(i)")
.swipeActions(edge: .leading) {
Button {
total += i
} label: {
Label("Add \(i)", systemImage: "plus.circle")
}
.tint(.indigo)
}
.swipeActions(edge: .trailing) {
Button {
total -= i
} label: {
Label("Subtract \(i)", systemImage: "minus.circle")
}
}
}
}
What would be the best approach to disable the swipeActions for let say the 50 row?
1
0
1.1k