Is there a way to provide the traditional pinch and zoom behaviour in pure SwiftUI

I'd like to provide the ability for users to pinch/zoom on a SwiftUI ScrollView for my custom content (it's a tree of nodes). Think like maps allows you to pinch and zoom in one gesture, where as you pan the content stays under your fingers, keeping you connected to it. This gesture feels so natural that when it's different it feels completely broken. Unfortunately I haven't found a way to provide this experience in SwiftUI.

We have MagnificationGesture but this doesn't supply translation information. Combining a DragGesture doesn't work either. If we had a single gesture that provided magnification and translation information then I think we could accomplish the behaviour users expect.

There is a related post from last year here

Has anyone found a way to accomplish this? I have also filed a radar if anyone wants to dupe:

  • FB9162379
  • http://www.openradar.me/radar?id=4950743358373888

Replies

This is an embarrassing missing feature in SwiftUI.