I have two requirements with ScrollView in SwiftUI.
-
Ability to zoom in/out subviews in the
ScrollViewwhile keeping the point of zoom stationary.UIScrollViewin UIKit haszoomScalewhich seems absent in SwiftUI. The MagnifyGesture in SwiftUI doesn’t seem to provide this as the point of pan/zoom is not stationary with it. -
Ability to long press subview and drag it to another place in
ScrollView. If the user keeps holding finger and drags subview near edges of theScrollViewframe, keep scrolling the scroll view in the direction of drag. If the user drags the subview outside of frame ofScrollView, it gets removed from view hierarchy.
These things are not difficult in UIKit, it seems not straightforward in SwiftUI. How can I achieve these in pure SwiftUI way?




