<!--
{
  "availability" : [
    "macOS: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSPreviewRepresentingActivityItem/init(item:title:imageProvider:iconProvider:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSPreviewRepresentingActivityItem(im)initWithItem:title:imageProvider:iconProvider:"
  },
  "title" : "init(item:title:imageProvider:iconProvider:)"
}
-->

# init(item:title:imageProvider:iconProvider:)

Creates a metadata object that provides a title and images for a shareable item.

```
init(item: Any, title: String?, imageProvider: NSItemProvider?, iconProvider: NSItemProvider?)
```

## Parameters

`item`

The item to share from the Mac share sheet. The item must conform to the [`NSPasteboardWriting`](/documentation/AppKit/NSPasteboardWriting) protocol, or be an <doc://com.apple.documentation/documentation/Foundation/NSItemProvider> or [`NSDocument`](/documentation/AppKit/NSDocument) object.

`title`

The localized name of the item.

`imageProvider`

An object that provides the image to display as a preview for the item. For example, when you share a URL for a webpage, you might specify the hero image for that page or a rendering of the webpage itself.

`iconProvider`

An object that a thumbnail-size image of the source of the item. Typically, you specify your app’s icon but you can provide a different icon if the content has a different source.

## Return Value

An initialized item to share.

---

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)