---
title: CVAttachmentKeyDefinitions
framework: corevideo
role: symbol
role_heading: Protocol
path: corevideo/cvattachmentkeydefinitions
---

# CVAttachmentKeyDefinitions

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

## Declaration

```swift
protocol CVAttachmentKeyDefinitions
```

## Overview

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, CVAttachmentKeyDefinitions.KeyWithDefault or 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: 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

- [CVAttachmentKeyDefinitions.CompositeKey](corevideo/cvattachmentkeydefinitions/compositekey.md)
- [CVAttachmentKeyDefinitions.Key](corevideo/cvattachmentkeydefinitions/key.md)
- [CVAttachmentKeyDefinitions.KeyWithDefault](corevideo/cvattachmentkeydefinitions/keywithdefault.md)
- [CVAttachmentKeyDefinitions.ShouldNotPropagate](corevideo/cvattachmentkeydefinitions/shouldnotpropagate.md)
- [CVAttachmentKeyDefinitions.ShouldPropagate](corevideo/cvattachmentkeydefinitions/shouldpropagate.md)

## Relationships

### Inherited By

- [CVImageBufferAttachmentKeyDefinitions](corevideo/cvimagebufferattachmentkeydefinitions.md)

### Conforming Types

- [CVPixelBufferAttachmentKeyDefinitions](corevideo/cvpixelbufferattachmentkeydefinitions.md)

## See Also

### Protocols

- [CVBufferRepresentable](corevideo/cvbufferrepresentable.md)
- [CVAttachmentModePreference](corevideo/cvattachmentmodepreference.md)
- [CVAttachmentValueRepresentable](corevideo/cvattachmentvaluerepresentable.md)
