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.
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.