One Logo Pool Ball
CoreVideo · IOS API REFERENCE

CVAttachmentAccess

struct · iOS 27.0+ · SDK 27.1

@dynamicMemberLookup struct CVAttachmentAccess<Keys> where Keys : CVAttachmentKeyDefinitions

Provides access to the attachments of a buffer. Lifetime of an instance of this type is tied to the lifetime of the buffer carrying attachments. The properties of this object are dynamically resolved to the static properties of the ``Keys`` type. For example, when custom attachment keys are defined as follows: ```swift extension CVImageBufferAttachmentKeyDefinitions { static var imageBufferName: Key<ShouldPropagate, String> { "com.app.imageBufferName" } } extension CVPixelBufferAttachmentKeyDefinitions { static var pixelBufferNumber: Key<ShouldPropagate, Int> { "com.app.pixelBufferNumber" } } ``` Both keys can be accessed as a property of an CVAttachmentAccess instance. As CVImageBufferAttachmentKeyDefinitions is the superclass of CVPixelBufferAttachmentKeyDefinitions. ```swift func inspect(attachments: borrowing CVAttachmentAccess<CVPixelBufferAttachmentKeyDefinitions>) { let value1: String? = attachments.imageBufferName let value2: Int? = attachments.pixelBufferNumber } ``` It is also possible to access the keys by directly specifying raw string value: ```swift let num: Int? = pixelBuffer.attachments["com.app.pixelBufferNumber"] pixelBuffer.attachments["com.app.pixelBufferNumber"] = (100, .shouldPropagate) // To set an attachment value by ignoring the preferred mode requires using rawValue of the key pixelBuffer.attachments[CVPixelBufferAttachmentKeyDefinitions.displayDimensions.rawValue] = (CGSize(width: 600, height: 400), .shouldNotPropagate) ```

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

11 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

CVAttachmentAccess.subscript(dynamicMember:)

Passing a Swift type itself is not supported.

CVAttachmentAccess.subscript(dynamicMember:)

Passing a Swift type itself is not supported.

CVAttachmentAccess.subscript(dynamicMember:)

Passing a Swift type itself is not supported.

CVAttachmentAccess.subscript(_:as:)

The containing type needs Swift generic type arguments. (no canonical witness for Keys)

CVAttachmentAccess.copy()

The containing type needs Swift generic type arguments. (no canonical witness for Keys)

CVAttachmentAccess.propagate(from:)

The containing type needs Swift generic type arguments. (no canonical witness for Keys)

CVAttachmentAccess.update(from:)

The containing type needs Swift generic type arguments. (no canonical witness for Keys)

CVAttachmentAccess.removeAll()

The containing type needs Swift generic type arguments. (no canonical witness for Keys)

CVAttachmentAccess.attachedMode(of:)

The containing type needs Swift generic type arguments. (no canonical witness for Keys)

CVAttachmentAccess.attachedMode(of:)

Passing a Swift type itself is not supported.

CVAttachmentAccess.attachedMode(of:)

Passing a Swift type itself is not supported.

All CoreVideo types →