Detect Swipe Action Context State
anthony1810 opened this issue · comments
I need something like this to adjust SwipeView
SwipeView {
teamNoteRow(note: note)
.contentShape(Rectangle())
} trailingActions: { context in
SwipeAction(action: {
withAnimation {
viewModel.deleteNote(id: note.id)
}
}, label: { _ in
Image(systemName: "trash")
.foregroundColor(Color.white)
}, background: { _ in
Color.red
})
.onReceive(context) { newValue in
isTrailingActionVisible = context == .open // globaly detect state of swipe actions
}