Contents

subscript(dynamicMember:)

Get or set attachment value as a property of this object.

Declaration

subscript<ModePreference, Value>(dynamicMember keyPath: KeyPath<Keys.Type, CVAttachmentKeyDefinition<ModePreference, Value>>) -> Value? where ModePreference : CVAttachmentModePreference, Value : CVAttachmentValueRepresentable { get set }

Overview

This subscript provides access to an attachment key as a property. The key to be accessed must be defined as a static property on the Keys type.

extension CVPixelBufferAttachmentKeyDefinitions {
	static var pixelBufferNumber: Key<ShouldPropagate, Int> {
		"com.app.pixelBufferNumber"
	}
}

func inspect(attachments: borrowing CVAttachmentAccess<CVPixelBufferAttachmentKeyDefinitions>) {
	let value: Int? = attachments.pixelBufferNumber
}