<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macCatalyst: -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFoundation",
  "identifier" : "/documentation/AVFoundation/AVAsynchronousVideoCompositionRequest/attach(_:to:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AVFoundation"
    ],
    "preciseIdentifier" : "s:So37AVAsynchronousVideoCompositionRequestC12AVFoundationE6attach_2toyAC09AVSpatialB13ConfigurationV_04CoreB020CVMutablePixelBufferVztKF"
  },
  "title" : "attach(_:to:)"
}
-->

# attach(_:to:)

Associates the pixel buffer with the specified spatial configuration.

```
func attach(_ spatialVideoConfiguration: AVSpatialVideoConfiguration, to pixelBuffer: inout CVMutablePixelBuffer) throws
```

## Parameters

`spatialVideoConfiguration`

The spatial configuration to associate with the pixel buffer.

`pixelBuffer`

The pixel buffer to associate with the spatial configuration.
NOTE: The spatial configuration must be one of the spatial configurations specified in the AVVideoComposition’s spatialConfigurations property. An exception will be thrown otherwise.
NOTE: All pixel buffers from the custom compositor must be associated with the same spatial configuration. An exception will be thrown otherwise.
Specify a value of .nonSpatial for spatialVideoConfiguration to indicate the video is not spatial, but note that a .nonSpatial configuration must be in the `AVVideoComposition/spatialConfigurations` property or an exception will be thrown.

---

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)