Hi,
I have a list cell with a play button and a text label.
When tapping the play button, it plays an audio, and when long-pressed, it plays the audio slowly.
The long press works as per the example code below, but once a contextMenu is added, the long-press gesture of the play button is ignored (even though it's a small element in the cell), and the context menu is presented instead.
Is there a way to allow for the context menu long-press to respect the long-press gesture of a child element in the cell on which it's defined?
I also tried with highPriorityGesture but to no effect.
Example code:
HStack {
Button { print("Play") } label: {
Image(systemName: "play.circle")
.onLongPressGesture(minimumDuration: 0.5) {
print("Play slowly")
}
}
Text("Audio cell")
.frame(maxWidth: .infinity, alignment: .leading)
}
.contextMenu {
Button("Hello") { print("hello") }
Button("Goodbye") { print("goodbye") }
}
0
0
24