---
title: "containsMedia(_:exportableAs:)"
framework: linkpresentation
role: symbol
role_heading: Instance Method
path: "linkpresentation/linkmetadata/containsmedia(_:exportableas:)"
---

# containsMedia(_:exportableAs:)

Determines if a specific Transferable type can be loaded for an attachment in the metadata.

## Declaration

```swift
nonisolated func containsMedia(_ attachment: LinkMetadata.Attachment, exportableAs type: (some Transferable).Type) -> Bool
```

## Parameters

- `attachment`: The kind of attachment to test, such as .image, .icon, and .video.
- `type`: The Transferable type of the media data to test.

## Return Value

Return Value true if the metadata contains the specified attachment and the attachment’s content type is compatible with the media type.

## Discussion

Discussion Use this function to immediately determine if metadata has some specific kind of media that can be coerced into a given type: if metadata.containsMedia(.image, exportableAs: SwiftUI.Image.self) {     // Load the image, and while waiting, display some loading indicator. } else {     // The metadata contains no image, so omit any UI for it. }
