SwiftUI MagnificationGesture broken in iPadOS 15?

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?

  • this Apple example does not work for me as well on ios15. It works if you use

    Circle() .frame(width: 100, height: 100, alignment: .center) .scaleEffect(magnifyBy) .gesture(magnification)

  • Interesting! Unfortunately this is does not give the same result, depending on the views content. Try Circle().stroke() for example, to see the difference in rendering.

  • Filed FB9333346 on Jul 15, 2021 and FB9684083 on Oct 7, 2021 but unfortunately the problem still persists. The documentation has been changed though, the old way seems to be discouraged though the .scaleEffect(magnifyBy) does not yield the same result.