<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/spatialOverlay(alignment:content:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE14spatialOverlay9alignment7contentQrAA11Alignment3DV_qd__yXEtAaBRd__lF"
  },
  "title" : "spatialOverlay(alignment:content:)"
}
-->

# spatialOverlay(alignment:content:)

Adds secondary views within the 3D bounds of this view.

```
@export(implementation) nonisolated func spatialOverlay<V>(alignment: Alignment3D = .center, @ContentBuilder content: () -> V) -> some View where V : View
```

## Parameters

`alignment`

The alignment with a default value of
[`center`](/documentation/SwiftUI/Alignment3D/center) that you use to position the secondary view.

`content`

The content builder which produces views to occupy the same 3D
space as this view. Multiple views provided by content are organized
into a [`SpatialContainer`](/documentation/SwiftUI/SpatialContainer).

## Return Value

A view that adds `content` within the view’s 3D bounds.

## Discussion

Multiple views provided by `content` are stacked depthwise.

---

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)