<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 12.0.0 -",
    "tvOS: 15.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 8.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreVideo",
  "identifier" : "/documentation/CoreVideo/CVBufferCopyAttachment(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Video"
    ],
    "preciseIdentifier" : "c:@F@CVBufferCopyAttachment"
  },
  "title" : "CVBufferCopyAttachment(_:_:_:)"
}
-->

# CVBufferCopyAttachment(_:_:_:)

Returns a copy of an attachment from a Core Video buffer.

```
func CVBufferCopyAttachment(_ buffer: CVBuffer, _ key: CFString, _ attachmentMode: UnsafeMutablePointer<CVAttachmentMode>?) -> CFTypeRef?
```

## Parameters

`buffer`

A buffer with an attachment to copy.

`key`

A string that identifies the attachment, which can be of any <doc://com.apple.documentation/documentation/CoreFoundation/CFTypeRef>. See [CVBuffer Attachment Keys](/documentation/CoreVideo/cvbuffer-attachment-keys) and [Image Buffer Attachment Keys](/documentation/CoreVideo/image-buffer-attachment-keys) for predefined values.

`attachmentMode`

On output, this value points to the mode of the attachment. See [`CVAttachmentMode`](/documentation/CoreVideo/CVAttachmentMode) for possible values. This value is <doc://com.apple.documentation/documentation/ObjectiveC/nil-227m0> if the buffer doesn’t define an attachment mode.

## Return Value

The requested attachment, or `nil` if no attachment for the specified key exists.

## Discussion

This function returns a retained attachment value, which you need to release when you’re done with it.

---

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)