subscript(dynamicMember:)
Get or set attachment value as a property of this object with default value.
Declaration
subscript<ModePreference, Value>(dynamicMember keyPath: KeyPath<Keys.Type, CVAttachmentKeyDefinitionWithDefault<ModePreference, Value>>) -> Value where ModePreference : CVAttachmentModePreference, Value : CVAttachmentValueRepresentable, Value : Equatable, Value : Sendable { 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 isSpecialPicture: KeyWithDefault<ShouldPropagate, Bool> {
.init("com.app.isSpecialPicture", default: false)
}
}
func inspect(attachments: borrowing CVAttachmentAccess<CVPixelBufferAttachmentKeyDefinitions>) {
if attachments.isSpecialPicture {
...
}
}