<!--
{
  "availability" : [
    "iOS: 4.0.0 -",
    "iPadOS: 4.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMedia",
  "identifier" : "/documentation/CoreMedia/CMSetAttachments(_:attachments:attachmentMode:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core Media"
    ],
    "preciseIdentifier" : "c:@F@CMSetAttachments"
  },
  "title" : "CMSetAttachments(_:attachments:attachmentMode:)"
}
-->

# CMSetAttachments(_:attachments:attachmentMode:)

Sets a dictionary of attachments on an attachment bearer object.

```
func CMSetAttachments(_ target: CMAttachmentBearer, attachments theAttachments: CFDictionary, attachmentMode: CMAttachmentMode)
```

## Parameters

`target`

The target `CMAttachmentBearer` to set the attachment to.

`theAttachments`

The attachments to set, in the form of a Core Foundation dictionary.

`attachmentMode`

Specifies the attachment mode for this attachment. A particular attachment key can only exist in a single mode at a time.

## Discussion

`CMSetAttachments` is a convenience call that in turn calls `CMSetAttachment` for each key and value in the given dictionary. All key value pairs must be in the root level of the dictionary.  Given a <doc://com.apple.documentation/documentation/CoreVideo/CVBuffer>, `CMSetAttachments` is equivalent to `CVBufferSetAttachments`.

---

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)