<!--
{
  "availability" : [
    "iOS: 26.4.0 -",
    "iPadOS: 26.4.0 -",
    "macCatalyst: 26.4.0 -",
    "macOS: 26.4.0 -",
    "tvOS: 26.4.0 -",
    "visionOS: 26.4.0 -",
    "watchOS: 26.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "LinkPresentation",
  "identifier" : "/documentation/LinkPresentation/LinkMetadata",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Link Presentation"
    ],
    "preciseIdentifier" : "s:16LinkPresentation0A8MetadataV"
  },
  "title" : "LinkMetadata"
}
-->

# LinkMetadata

A structure containing metadata about a URL.

```
nonisolated struct LinkMetadata
```

## Overview

Use [`LinkMetadata`](/documentation/LinkPresentation/LinkMetadata) to store metadata about a URL, including its title, icon, images, and video.

Fetch metadata using [`LPMetadataProvider`](/documentation/LinkPresentation/LPMetadataProvider). For remote URLs, cache the metadata locally to avoid
the data and performance cost of fetching it from the internet every time you present it.
[`LinkMetadata`](/documentation/LinkPresentation/LinkMetadata) is also serializable and conforms to `Codable`.

## Topics

### Structures

[`struct Attachment`](/documentation/LinkPresentation/LinkMetadata/Attachment)

Describes a kind of attachment to the metadata.

### Initializers

[`init?(sending LPLinkMetadata)`](/documentation/LinkPresentation/LinkMetadata/init(_:))

Creates a [`LinkMetadata`](/documentation/LinkPresentation/LinkMetadata) value from a [`LPLinkMetadata`](/documentation/LinkPresentation/LPLinkMetadata) instance.

[`init(fetching: URL, timeout: Duration, includeSubresources: Bool) async throws`](/documentation/LinkPresentation/LinkMetadata/init(fetching:timeout:includeSubresources:)-69bj2)

Creates a [`LinkMetadata`](/documentation/LinkPresentation/LinkMetadata) value from the specified properties by fetching the specified URL.

[`init(fetching: URLRequest, timeout: Duration, includeSubresources: Bool) async throws`](/documentation/LinkPresentation/LinkMetadata/init(fetching:timeout:includeSubresources:)-7rkd9)

Creates a [`LinkMetadata`](/documentation/LinkPresentation/LinkMetadata) value from the specified properties by fetching the URL using the specified request.

[`init(url: URL)`](/documentation/LinkPresentation/LinkMetadata/init(url:))

Creates a new [`LinkMetadata`](/documentation/LinkPresentation/LinkMetadata) value for the specified URL.

### Instance Properties

[`var originalURL: URL`](/documentation/LinkPresentation/LinkMetadata/originalURL)

The original URL of the metadata request.

[`var remoteVideo: URL?`](/documentation/LinkPresentation/LinkMetadata/remoteVideo)

A remote URL corresponding to a representative video for the URL

[`var title: String?`](/documentation/LinkPresentation/LinkMetadata/title)

A representative title for the URL.

[`var url: URL`](/documentation/LinkPresentation/LinkMetadata/url)

The URL that returned the metadata, taking server-side redirects into account.

### Instance Methods

[`func containsMedia(LinkMetadata.Attachment, exportableAs: (some Transferable).Type) -> Bool`](/documentation/LinkPresentation/LinkMetadata/containsMedia(_:exportableAs:))

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

[`func media<Media>(LinkMetadata.Attachment, as: Media.Type) async throws -> Media?`](/documentation/LinkPresentation/LinkMetadata/media(_:as:))

Loads the media data of this metadata for an attachment as the specified Transferable type if possible.

[`func setMedia(some Transferable, for: LinkMetadata.Attachment)`](/documentation/LinkPresentation/LinkMetadata/setMedia(_:for:))

Sets the media data in the metadata for an attachment.

### Type Aliases

[`typealias Specification`](/documentation/LinkPresentation/LinkMetadata/Specification)

[`typealias UnwrappedType`](/documentation/LinkPresentation/LinkMetadata/UnwrappedType)

[`typealias ValueType`](/documentation/LinkPresentation/LinkMetadata/ValueType)

### Type Properties

[`static var defaultResolverSpecification: some ResolverSpecification`](/documentation/LinkPresentation/LinkMetadata/defaultResolverSpecification)

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`IntentValueConvertible`](/documentation/AppIntents/IntentValueConvertible)

[`PersistentlyIdentifiable`](/documentation/AppIntents/PersistentlyIdentifiable)

[`InstanceDisplayRepresentable`](/documentation/AppIntents/InstanceDisplayRepresentable)

[`IntentValueExpressing`](/documentation/AppIntents/IntentValueExpressing)

[`DisplayRepresentable`](/documentation/AppIntents/DisplayRepresentable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Transferable`](/documentation/CoreTransferable/Transferable)

[`Escapable`](/documentation/Swift/Escapable)

[`CustomLocalizedStringResourceConvertible`](/documentation/Foundation/CustomLocalizedStringResourceConvertible)

[`Decodable`](/documentation/Swift/Decodable)

[`Copyable`](/documentation/Swift/Copyable)

[`TypeDisplayRepresentable`](/documentation/AppIntents/TypeDisplayRepresentable)

[`Encodable`](/documentation/Swift/Encodable)

---

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)