I would like to overlay my image with several Rectangle()s, that should respond to gestures (like tapping or dragging). However, I found that when I make the rectangle clear, it stops receiving gestures.
Rectangle()
.fill(.clear)
.gesture(
LongPressGesture()
.onEnded { value in
// this isn't called when the rectangle fill is .clear
}
)
Is there a way to let an invisible element receive taps? I know that I could give it a 1 % opacity, but that feels like an ugly (and visible) kludge.