onTapGesture seems like it's incredibly unreliable (eg clicks/taps don't always trigger the onTapGesture closures -- best case is that they're intermittent) in Big Sur for Catalyst apps. The same code runs without problem on iOS 14 and Catalina (again, with Catalyst).
Consider the following basic example:
Try to tap the green and blue squares. Best case for me (Big Sur, 11.0.1) is that sometimes onTapGesture will get called.
The easy solution is to convert them to Buttons instead -- but, there are plenty of situations where that isn't ideal (Buttons, for example, don't play nicely with DragGesture).
Is there any way around this bug? Some way to make it work? Or am I stuck until an update restores functionality with Catalina/iOS 14
Consider the following basic example:
Code Block struct ContentView: View { @State private var greenOn = false @State private var blueOn = false var body: some View { HStack { Rectangle() .fill(Color.green) .opacity(greenOn ? 1.0 : 0.5) .frame(width: 100, height: 100) .contentShape(Rectangle()) .onTapGesture(count: 1, perform: { greenOn.toggle() print("Tapped") }) Rectangle() .fill(Color.blue) .opacity(blueOn ? 1.0 : 0.5) .frame(width: 100, height: 100) .onTapGesture(count: 1, perform: { blueOn.toggle() print("Tapped 2") }) } } }
Try to tap the green and blue squares. Best case for me (Big Sur, 11.0.1) is that sometimes onTapGesture will get called.
The easy solution is to convert them to Buttons instead -- but, there are plenty of situations where that isn't ideal (Buttons, for example, don't play nicely with DragGesture).
Is there any way around this bug? Some way to make it work? Or am I stuck until an update restores functionality with Catalina/iOS 14