---
title: "spatialOverlay(alignment:content:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/spatialoverlay(alignment:content:)"
---

# spatialOverlay(alignment:content:)

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

## Declaration

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

```

## Parameters

- `alignment`: The alignment with a default value of doc://com.apple.SwiftUI/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 doc://com.apple.SwiftUI/documentation/SwiftUI/SpatialContainer.

## Return Value

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

## Discussion

Discussion Multiple views provided by content are stacked depthwise.

## See Also

### Foreground elements

- [border(_:width:)](swiftui/view/border(_:width:).md)
- [overlay(alignment:content:)](swiftui/view/overlay(alignment:content:).md)
- [overlay(_:ignoresSafeAreaEdges:)](swiftui/view/overlay(_:ignoressafeareaedges:).md)
- [overlay(_:in:fillStyle:)](swiftui/view/overlay(_:in:fillstyle:).md)
- [spatialOverlayPreferenceValue(_:alignment:_:)](swiftui/view/spatialoverlaypreferencevalue(_:alignment:_:).md)
