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?

Generated on 8/8/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.

What’s new in watchOS 11

What’s new in watchOS 11

Explore new opportunities on Apple Watch, including bringing Double Tap support to your watchOS app, making your Smart Stack widgets even more relevant and interactive, and displaying your iOS Live Activities in the Smart Stack.

What’s new in UIKit

What’s new in UIKit

Explore everything new in UIKit, including tab and document launch experiences, transitions, and text and input changes. We’ll also discuss better-than-ever interoperability between UIKit and SwiftUI animations and gestures, as well as general improvements throughout UIKit.

Get started with HealthKit in visionOS

Get started with HealthKit in visionOS

Discover how to use HealthKit to create experiences that take full advantage of the spatial canvas. Learn the capabilities of HealthKit on the platform, find out how to bring an existing iPadOS app to visionOS, and explore the special considerations governing HealthKit during a Guest User session. You’ll also learn ways to use SwiftUI, Swift Charts, and Swift concurrency to craft innovative experiences with HealthKit.

Bring your iOS or iPadOS game to visionOS

Bring your iOS or iPadOS game to visionOS

Discover how to transform your iOS or iPadOS game into a uniquely visionOS experience. Increase the immersion (and fun factor!) with a 3D frame or an immersive background. And invite players further into your world by adding depth to the window with stereoscopy or head tracking.

Explore object tracking for visionOS

Explore object tracking for visionOS

Find out how you can use object tracking to turn real-world objects into virtual anchors in your visionOS app. Learn how you can build spatial experiences with object tracking from start to finish. Find out how to create a reference object using machine learning in Create ML and attach content relative to your target object in Reality Composer Pro, RealityKit or ARKit APIs.

Explore game input in visionOS

Explore game input in visionOS

Discover how to design and implement great input for your game in visionOS. Learn how system gestures let you provide frictionless ways for players to interact with your games. And explore best practices for supporting custom gestures and game controllers.