---
title: "activityViewControllerLinkMetadata(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uiactivityitemsource/activityviewcontrollerlinkmetadata(_:)"
---

# activityViewControllerLinkMetadata(_:)

Returns metadata to display in the preview header of the share sheet.

## Declaration

```swift
optional func activityViewControllerLinkMetadata(_ activityViewController: UIActivityViewController) -> LPLinkMetadata?
```

## Parameters

- `activityViewController`: The doc://com.apple.uikit/documentation/UIKit/UIActivityViewController object requesting information about the item that the user wants to share.

## Return Value

Return Value The LPLinkMetadata object that contains the metadata about a URL, including its title, icon, images, and video.

## Discussion

Discussion Using the Link Presentation framework, you can display rich previews of web links inside your app. For instance, if your app already has a database of links, with titles and images that weren’t fetched by LPMetadataProvider, you don’t have to fetch new metadata from the internet. Use this method instead and avoid downloading it again. In your implementation, create an LPLinkMetadata object, and fill in at least the originalURL and url fields, plus whatever additional information you have. func activityViewControllerLinkMetadata(_: UIActivityViewController) -> LPLinkMetadata? {     let metadata = LPLinkMetadata()     metadata.originalURL = URL(string: "https://www.example.com/apple-pie")     metadata.url = metadata.originalURL     metadata.title = "The Greatest Apple Pie In The World"     metadata.imageProvider = NSItemProvider.init(contentsOf:         Bundle.main.url(forResource: "apple-pie", withExtension: "jpg"))     return metadata } To learn more about presenting rich links and accelerating the share sheet, see Link Presentation and LPMetadataProvider, or watch the WWDC 2019 session 262: Embedding and Sharing Visually Rich Links.
