---
title: "CMSetAttachments(_:attachments:attachmentMode:)"
framework: coremedia
role: symbol
role_heading: Function
path: "coremedia/cmsetattachments(_:attachments:attachmentmode:)"
---

# CMSetAttachments(_:attachments:attachmentMode:)

Sets a dictionary of attachments on an attachment bearer object.

## Declaration

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

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 CVBuffer, CMSetAttachments is equivalent to CVBufferSetAttachments.

## See Also

### Processing Attachments

- [CMGetAttachment(_:key:attachmentModeOut:)](coremedia/cmgetattachment(_:key:attachmentmodeout:).md)
- [CMCopyDictionaryOfAttachments(allocator:target:attachmentMode:)](coremedia/cmcopydictionaryofattachments(allocator:target:attachmentmode:).md)
- [CMSetAttachment(_:key:value:attachmentMode:)](coremedia/cmsetattachment(_:key:value:attachmentmode:).md)
- [CMRemoveAttachment(_:key:)](coremedia/cmremoveattachment(_:key:).md)
- [CMRemoveAllAttachments(_:)](coremedia/cmremoveallattachments(_:).md)
- [CMPropagateAttachments(_:destination:)](coremedia/cmpropagateattachments(_:destination:).md)
