<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreVideo",
  "identifier" : "/documentation/CoreVideo/CVAttachmentKeyDefinitions",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "Core Video"
    ],
    "preciseIdentifier" : "s:9CoreVideo26CVAttachmentKeyDefinitionsP"
  },
  "title" : "CVAttachmentKeyDefinitions"
}
-->

# CVAttachmentKeyDefinitions

Marks a type as a collection of attachment keys for an attachment bearer.

```
protocol CVAttachmentKeyDefinitions
```

## Overview

The static properties of a type which implements this protocol provide definitions for the attachment keys. The
static properties which have one of [`CVAttachmentKeyDefinitions.Key`](/documentation/CoreVideo/CVAttachmentKeyDefinitions/Key), [`CVAttachmentKeyDefinitions.KeyWithDefault`](/documentation/CoreVideo/CVAttachmentKeyDefinitions/KeyWithDefault) or [`CVAttachmentKeyDefinitions.CompositeKey`](/documentation/CoreVideo/CVAttachmentKeyDefinitions/CompositeKey) type are used by an attachment
access provider to get and set attachment values.

For example, a custom attachment key for pixel buffers can be defined as:

```swift
extension CVPixelBufferAttachmentKeyDefinitions {
	// This extension makes the key available as a property of `pixelBuffer.attachments`.
	static var customAttachment: Key<ShouldPropagate, CustomAttachmentValue> {
		.init("com.myapp.customAttachmentKey")
	}
}

// This extension facilitates conversion between CustomAttachmentValue and CVAttachmentRawValue
extension CustomAttachmentValue: CVAttachmentValueRepresentable {
	static func makeFromRawAttachmentValue(_ repr: CVAttachmentRawValue) -> Self? {
		...
	}

	var rawAttachmentValueRepresentation: CVAttachmentRawValue {
		...
	}
}
```

## Topics

### Type Aliases

[`typealias CompositeKey`](/documentation/CoreVideo/CVAttachmentKeyDefinitions/CompositeKey)

[`typealias Key`](/documentation/CoreVideo/CVAttachmentKeyDefinitions/Key)

[`typealias KeyWithDefault`](/documentation/CoreVideo/CVAttachmentKeyDefinitions/KeyWithDefault)

[`typealias ShouldNotPropagate`](/documentation/CoreVideo/CVAttachmentKeyDefinitions/ShouldNotPropagate)

[`typealias ShouldPropagate`](/documentation/CoreVideo/CVAttachmentKeyDefinitions/ShouldPropagate)

## Relationships

### Inherited By

[`CVImageBufferAttachmentKeyDefinitions`](/documentation/CoreVideo/CVImageBufferAttachmentKeyDefinitions)

### Conforming Types

[`CVPixelBufferAttachmentKeyDefinitions`](/documentation/CoreVideo/CVPixelBufferAttachmentKeyDefinitions)

---

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)