<!--
{
  "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/CVAttachmentAccess/subscript(dynamicMember:)-38ve9",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Subscript",
  "symbol" : {
    "kind" : "Instance Subscript",
    "modules" : [
      "Core Video"
    ],
    "preciseIdentifier" : "s:9CoreVideo18CVAttachmentAccessV13dynamicMemberqd_0_s7KeyPathCyxmAA0cG21DefinitionWithDefaultVyqd__qd_0_GG_tcAA0C14ModePreferenceRd__AA0C18ValueRepresentableRd_0_SQRd_0_s8SendableRd_0_r0_luip"
  },
  "title" : "subscript(dynamicMember:)"
}
-->

# subscript(dynamicMember:)

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

```
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.

```swift
extension CVPixelBufferAttachmentKeyDefinitions {
	static var isSpecialPicture: KeyWithDefault<ShouldPropagate, Bool> {
		.init("com.app.isSpecialPicture", default: false)
	}
}

func inspect(attachments: borrowing CVAttachmentAccess<CVPixelBufferAttachmentKeyDefinitions>) {
	if attachments.isSpecialPicture {
		...
	}
}
```

---

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)