i upgraded my app to use visionos2 sdk. but now my tap wont work on a button in a vgrid, any ideas what might have messed up my tap gesture?

Asked on 08/08/2024

1 search

It sounds like your tap gesture might not be working due to some changes in how gestures are handled in visionOS 2. Here are a few things you can check based on the information from WWDC sessions:

  1. Input Target and Collision Component: Ensure that any entities you want to be tappable have both an input target component and a collision component. This is necessary for the system to recognize tap gestures on those entities.

    Explore game input in visionOS

  2. Gesture Attachment: Make sure that the gesture is attached to the reality view that contains your entities. This allows the system to detect and respond to the gesture appropriately.

    Explore game input in visionOS

  3. Gesture Recognizers Coordination: If you are using both UIKit and SwiftUI, ensure that the gesture recognizers are coordinated properly. In iOS 18, you can specify dependencies between gestures across both frameworks to prevent conflicts.

    What’s new in UIKit

  4. System Gestures: VisionOS supports a variety of system gestures, including single tap, double tap, pinch and hold, and pinch and drag. Ensure that your app is correctly set up to respond to these gestures.

    Explore game input in visionOS

By verifying these aspects, you should be able to identify and resolve the issue with your tap gesture in the VGrid. If you need more detailed guidance, you might want to refer to the full session on Explore game input in visionOS.