Bringing Your ARKit App to visionOS: A Developer’s Guide

Overview
  • Rethinking ARKit Integration: Unlike iOS where ARKit is instrumental in displaying augmented reality content, in visionOS, ARKit is solely used for acquiring data about the surroundings, utilizing a different set of APIs.
  • Building with SwiftUI or UIKit: In visionOS, augmented reality interfaces don’t require a special view. Instead, utilize SwiftUI or UIKit to construct windows with app content, seamlessly integrating them into the user’s surroundings.
  • Reusing Existing Content: Leverage the compatibility of visionOS with iOS technologies, allowing reuse of project assets, 3D models, and most custom views. However, avoid reusing ARKit-specific code or code reliant on unsupported technologies in visionOS.

Adopting Technologies
  • Preferred Technologies: Opt for SwiftUI and RealityKit, the preferred technologies in visionOS. Consider transitioning to RealityKit for 3D content, ensuring seamless integration with visionOS.
  • Utilizing Metal: While Metal can be used to create content for 2D views or fully immersive experiences, it cannot be utilized for creating 3D content that interacts with the surroundings due to privacy concerns.
Converting 3D Assets
  • USDZ Format: Convert 3D assets to USDZ format, the recommended format for iOS and visionOS. Use the Reality Converter tool in Xcode for conversion, ensuring a compact single file for all assets.
  • Reality Composer Pro: Employ Reality Composer Pro to create scenes incorporating USDZ assets, enabling nondestructive editing and dynamic shader creation with MaterialX shaders.
Updating Interface for visionOS
  • Content Management: Unlike iOS, where a special ARKit view blends content with the camera feed, in visionOS, focus solely on app content. Utilize SwiftUI or UIKit views to display content directly.
  • Substitutions for AR Experience: Replace ARKit-dependent code with RealityKit and RealityView for 2D and 3D content integration into the surroundings.
Replacing ARKit Code
  • Usage Differences: Understand the distinction in utilizing ARKit between iOS and visionOS. In visionOS, ARKit is primarily used for interactions with the surroundings, necessitating modifications in code implementation.
  • Isolating iOS-exclusive Features: Identify and isolate ARKit features exclusive to iOS, such as face tracking or object detection, in the iOS version of the app, ensuring compatibility with visionOS.
Conclusion

Bringing your ARKit app to visionOS requires thoughtful adaptation and utilization of compatible technologies. By reimagining ARKit integration, updating interfaces, and isolating platform-specific features, developers can seamlessly transition their apps to the spatial computing realm of visionOS.

Leave a comment