Is there an equivalent for attachments in iOS' ARView?

I really love the way how you can add SwiftUI views as attachments to a RealityView on visionOS. As I am now porting my app to iOS as well, I was wondering if something like this is possible in ARView as well? I've only seen custom libraries trying to mimic UI elements so far.

Answered by Vision Pro Engineer in 790180022

Great timing of your question! We just announced that RealityView is coming to iOS 18 and macOS 15. Checkout the Discover RealityKit APIs for iOS, macOS and visionOS session and accompanying sample code to learn more. The Attachment API is only supported in visionOS. Please file an enhancement request using Feedback Assistant including as much detail as you can on how you'd like to use this API.

Consider your experience and how best to translate this to other devices. On smaller screens having UI inside of the 3D space may be hard for the user to interact with and moving those controls to elsewhere in your UI may create a better user experience.

For a similar effect to attachments, you can use ImageRender to create images from your SwiftUI views and add those views to entities and apply components and gestures to make those entities interactive.

Great timing of your question! We just announced that RealityView is coming to iOS 18 and macOS 15. Checkout the Discover RealityKit APIs for iOS, macOS and visionOS session and accompanying sample code to learn more. The Attachment API is only supported in visionOS. Please file an enhancement request using Feedback Assistant including as much detail as you can on how you'd like to use this API.

Consider your experience and how best to translate this to other devices. On smaller screens having UI inside of the 3D space may be hard for the user to interact with and moving those controls to elsewhere in your UI may create a better user experience.

For a similar effect to attachments, you can use ImageRender to create images from your SwiftUI views and add those views to entities and apply components and gestures to make those entities interactive.

Awesome to hear that! Yet we definitely would want to see the attachments API on iOS as well. Our use-case is to place labels on real-world objects.

You may also want to check out these developer samples teaching how to implement annotations in screen space for virtual objects:

Is there an equivalent for attachments in iOS' ARView?
 
 
Q