The Apple Maps app allows for simultaneous two-finger drag and magnification. I have tried implementing this functionality with SwiftUI gestures. Simultaneous rotation and magnification works as expected, but simultaneous drag and magnification does not. Maybe there is a way to conform to the Gesture protocol for custom behavior?
Asked
Active
Viewed 694 times
2 Answers
3
I was not able to achieve simultaneous drag and magnification. From my experience DragGesture works only with one touch and ends as soon as there are two touches on the screen. I appears that only gestures requiring the same amount of touches can be simultaneous in SwiftUI. There is also no direct access to touch events to implement custom gesture recognisers. Hope this will change in the future.

SirDeleck
- 121
- 1
- 6
0
I had same question. Check out this solution --> https://betterprogramming.pub/gestures-in-swiftui-e94b784ecc7
He uses: "simultaneously"
.gesture(MagnificationGesture()
.onChanged { value in
self.magnificationValue = value
}
.simultaneously(with: RotationGesture().onChanged { value in
self.rotationValue = value
}))
Hope this helps.

kopeezie
- 16
- 3
-
1
-
sorry, yes, I did not do the drag, and to confirm when using simultaneously with drag it didnt work? – kopeezie Aug 01 '22 at 18:24