<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/View/spatialOverlayPreferenceValue(_:alignment:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE29spatialOverlayPreferenceValue_9alignment_Qrqd__m_AA11Alignment3DVqd_0_0G0Qyd__ctAA0F3KeyRd__AaBRd_0_r0_lF"
  },
  "title" : "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.

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

---

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)