Caveats

UIScreen Not accessible

This won't be accessible in xrOS because there are no bounds to calculate.
You can just isolate this logic with wildcard checks specifically to avoid VisionOS.


#if !os(xrOS)
#if !os(visionOS)
#endif

Updated from xrOS to visionOS
Updated swift docs

.frame(width: UIScreen.main.bounds.width, height: 200)

It was recommended to use UIWindowScene but I couldn't figure it out.

Previews have different syntax for VisionOS vs iPad / iOS

#Preview {
    ContentView()
}
#Preview(windowStyle: .automatic) {
    MainView()
}

Migration to visionOS