I'm trying to use a button with .simultaneousGesture with a DragGesture to detect button down and button up (instead of just the click):
.simultaneousGesture(
DragGesture(minimumDistance: 0)
.onChanged({ _ in
print("onChanged")
isPressed = true
})
.onEnded({ _ in
print("onEnded")
isPressed = false
})
)
This works nicely on iOS, but neither onChanged nor onEnded is ever invoked on macOS.
Is there a way to make this work on macOS? Or an alternative SwiftUI way to detect mouse down / mouse up on a button?