The following code is shown on apples documentation page for SwiftUI MagnificationGesture:
struct MagnificationGestureView: View {
@GestureState var magnifyBy = CGFloat(1.0)
var magnification: some Gesture {
MagnificationGesture()
.updating($magnifyBy) { currentState, gestureState, transaction in
gestureState = currentState
}
}
var body: some View {
Circle()
.frame(width: 100 * magnifyBy,
height: 100 * magnifyBy,
alignment: .center)
.gesture(magnification)
}
}
Try it (on device) in the Swift Playgrounds App by prepending
import SwiftUI
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
PlaygroundPage.current.setLiveView(MagnificationGestureView())
or as a compiled app using the app template in Xcode and try to scale the circle to different sizes in succession.
On iPadOS 14 everything works as expected, but since iPadOS 15 Beta 2 it hangs after a few movements of the fingers.
Does it work for you?
What am I doing wrong? I already filed feedback, but the problem remains till the current beta version and I don't know how to get the gestures working again?