---
title: "spatialOverlayPreferenceValue(_:alignment:_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/spatialoverlaypreferencevalue(_:alignment:_:)"
---

# spatialOverlayPreferenceValue(_:alignment:_:)

Uses the specified preference value from the view to produce another view occupying the same 3D space of the first view.

## Declaration

```swift
nonisolated func spatialOverlayPreferenceValue<K, V>(_ key: K.Type, alignment: Alignment3D = .center, @ContentBuilder _ transform: @escaping (K.Value) -> V) -> some View where K : PreferenceKey, V : View

```

## 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)
- [spatialOverlay(alignment:content:)](swiftui/view/spatialoverlay(alignment:content:).md)
