---
title: attachments
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/nsextensionitem/attachments
---

# attachments

An optional array of media data associated with the extension item.

## Declaration

```swift
var attachments: [NSItemProvider]? { get set }
```

## Discussion

Discussion Populate this array with images, videos, URLs, and so on. It’s not meant to be an array of alternative data formats or types, but is instead a collection to include in a social media post, for example. These items are always typed NSItemProvider. important: Alternatively, you can set attachments in the userInfo dictionary using the NSExtensionItemAttachmentsKey key. However, setting the userInfo dictionary after setting attachments will override this property.

## See Also

### Item Contents

- [attributedContentText](foundation/nsextensionitem/attributedcontenttext.md)
