I have a problem with the MagnificationGesture in SwiftUI on the Mac. I am writing a Mac app and I want to scale a view. When I run the program, it works fine for a couple of times and then the onChanged closure does not get executed anymore. I am afraid this is a bug (or do I completely misunderstand something?). I actually found a very recent question on Reddit, where someone has the exact same issue: https://www.reddit.com/r/SwiftUI/comments/sd43rk/im_having_an_issue_with_the_magnificationgesture/
I could reproduce the problem in a very simple view:
struct ContentView: View {
var body: some View {
Text("Hello, world!")
.padding()
.gesture(MagnificationGesture()
.onChanged({ value in
print(value)
}))
}
}
How can I solve this?