Reputation:
Hello I am trying to simply add a swipe action to a list of subviews In the parent view. Each subview is its own navigation link and putting the swipe action is not working. How can I fix this. I don't get any errors though in the code.
struct Tip: Identifiable, Codable, Hashable{
var id: String
var caption: String
var link: String
}
ForEach(viewModel.ThreeTips) { tip in
TipRowView(tip: tip)
.swipeActions {
Button {
} label: {
Text("delete")
}
}
.tint(.red)
}
Upvotes: 0
Views: 303
Reputation: 2335
I believe swipeActions
is meant for List
(and it works there):
List(viewModel.ThreeTips, id: \.self) { tip in
TipRowView(tip: tip)
.swipeActions {
Button {
} label: {
Text("delete")
}
}
.tint(.red)
}
Upvotes: 1