<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "visionOS: 1.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/CoordinateSpaceProtocol/immersiveSpace",
  "metadataVersion" : "0.1.0",
  "role" : "Type Property",
  "symbol" : {
    "kind" : "Type Property",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI23CoordinateSpaceProtocolPA2A05NamedcD0VRszrlE09immersiveD0AEvpZ"
  },
  "title" : "immersiveSpace"
}
-->

# immersiveSpace

The named coordinate space that represents the currently opened
[`ImmersiveSpace`](/documentation/SwiftUI/ImmersiveSpace) scene.
If no immersive space is currently opened, this CoordinateSpace provides
the same behavior as the `.global` coordinate space.

```
static var immersiveSpace: NamedCoordinateSpace { get }
```

## Discussion

Use this to convert transforms from a window to an immersive space.
The following sample converts the top-leading-back origin of a Model3D
view to coordinates in the immersive space.

```swift
Model3D(url: URL(string: "https://example.com/robot.usdz")!)
    .onGeometryChange3D(for: AffineTransform3D.self) { proxy in
        // Convert the view's transform to the immersive space
        return proxy.transform(in: .immersiveSpace) ?? .identity
    } action: { transform in
        appModel.immersiveSpaceFromCuboid = transform
    }
```

Then, apply it to a corresponding Model3D in the immersive space.

```swift
if let transform = appModel.immersiveSpaceFromRobot {
    Model3D(url: URL(string: "https://example.com/robot.usdz")!)
        // Align the origin of this Model3D to its top-leading-back
        .visualEffect3D { effect, proxy in
            effect
                .offset(x: proxy.size.width/2, y: proxy.size.height/2)
                .offset(z: proxy.size.depth/2)
        }
        // Apply the transform in SRT order
       .scaleEffect(transform.scale)
       .rotation3DEffect(transform.rotation ?? .identity)
       .transform3DEffect(AffineTransform3D(
           translation: transform.translation))
}
```

To apply scale and rotation relative to a view’s origin, don’t
set them at the same time using [`transform3DEffect(_:)`](/documentation/SwiftUI/View/transform3DEffect(_:)).
Instead, set them separately using [`scaleEffect(_:anchor:)`](/documentation/SwiftUI/View/scaleEffect(_:anchor:))
together with [`rotation3DEffect(_:anchor:)`](/documentation/SwiftUI/View/rotation3DEffect(_:anchor:)).

> Note: See WWDC24 session 
> [10153: Dive deep into volumes and immersive
> spaces](https://developer.apple.com/wwdc24/10153/) for details on how to convert
> between coordinate spaces with SwiftUI and RealityKit.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)