One Logo Pool Ball
LinkPresentation · IOS API REFERENCE

LinkMetadata

struct · iOS 26.4+ · SDK 27.1

nonisolated struct LinkMetadata

A structure containing metadata about a URL. Use ``LinkMetadata`` to store metadata about a URL, including its title, icon, images, and video. Fetch metadata using ``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`` is also serializable and conforms to ``Codable``.

Members (12)

get · iOS 26.4+

originalURL

TypeScript
get originalURL(): string
Swift declaration
nonisolated var originalURL: URL { get set }

The original URL of the metadata request.

set · iOS 26.4+

originalURL

TypeScript
set originalURL(value: string)
Swift declaration
nonisolated var originalURL: URL { get set }

The original URL of the metadata request.

get · iOS 26.4+

remoteVideo

TypeScript
get remoteVideo(): (string) | null
Swift declaration
nonisolated var remoteVideo: URL? { get set }

A remote URL corresponding to a representative video for the URL

set · iOS 26.4+

remoteVideo

TypeScript
set remoteVideo(value: (string) | null)
Swift declaration
nonisolated var remoteVideo: URL? { get set }

A remote URL corresponding to a representative video for the URL

get · iOS 26.4+

url

TypeScript
get url(): string
Swift declaration
nonisolated var url: URL { get set }

The URL that returned the metadata, taking server-side redirects into account. The URL that returns the metadata may differ from the ``LinkMetadata/originalURL`` to which you sent the metadata request. This can happen if the server redirects the request, for example, when a resource has moved, or when the original URL is a domain alias.

set · iOS 26.4+

url

TypeScript
set url(value: string)
Swift declaration
nonisolated var url: URL { get set }

The URL that returned the metadata, taking server-side redirects into account. The URL that returns the metadata may differ from the ``LinkMetadata/originalURL`` to which you sent the metadata request. This can happen if the server redirects the request, for example, when a resource has moved, or when the original URL is a domain alias.

init · iOS 26.4+

init

TypeScript
static initUrl(url: string): LinkMetadata
Swift declaration
nonisolated init(url: URL)

Creates a new ``LinkMetadata`` value for the specified URL. - Parameter url: The URL that the metadata is for.

get · iOS 26.4+

title

TypeScript
get title(): (string) | null
Swift declaration
nonisolated var title: String? { get set }

A representative title for the URL.

set · iOS 26.4+

title

TypeScript
set title(value: (string) | null)
Swift declaration
nonisolated var title: String? { get set }

A representative title for the URL.

init · iOS 26.4+

init

TypeScript
static initFetchingTimeoutIncludeSubresources(request: _Foundation_URLRequest, timeout?: SDKHandle, includeSubresources?: boolean): Promise<LinkMetadata>
Swift declaration
nonisolated init(fetching request: URLRequest, timeout: Duration = .seconds(30), includeSubresources: Bool = true) async throws

Creates a ``LinkMetadata`` value from the specified properties by fetching the URL using the specified request. Metadata fetching supports Task cancellation; if the enclosing Task is cancelled, the metadata request will be cancelled. - Parameters: - request: The URL request to fetch the metadata from. - timeout: The time interval after which the request automatically fails if it hasn’t already completed. By default, this is 30 seconds. If a metadata fetch takes longer than the timeout interval, an ``Error`` is thrown. - includeSubresources: Determines if subresources should be fetched in addition to the main resource. If `true`, additional data will be fetched from the network to provide subresources such as images and icons. If `false`, no additional networking is done.

init · iOS 26.4+

init

TypeScript
static initFetchingTimeoutIncludeSubresources27880(url: string, timeout?: SDKHandle, includeSubresources?: boolean): Promise<LinkMetadata>
Swift declaration
nonisolated init(fetching url: URL, timeout: Duration = .seconds(30), includeSubresources: Bool = true) async throws

Creates a ``LinkMetadata`` value from the specified properties by fetching the specified URL. Metadata fetching supports Task cancellation; if the enclosing Task is cancelled, the metadata request will be cancelled. - Parameters: - url: The URL to fetch the metadata from. - timeout: The time interval after which the request automatically fails if it hasn’t already completed. By default, this is 30 seconds. If a metadata fetch takes longer than the timeout interval, an ``Error`` is thrown. - includeSubresources: Determines if subresources should be fetched in addition to the main resource. If `true`, additional data will be fetched from the network to provide subresources such as images and icons. If `false`, no additional networking is done.

init · iOS 26.4+

init

TypeScript
static init(metadata: LPLinkMetadata): (LinkMetadata) | null
Swift declaration
nonisolated init?(_ metadata: sending LPLinkMetadata)

Creates a ``LinkMetadata`` value from a ``LPLinkMetadata`` instance. - Parameter metadata: The `LPLinkMetadata` instance to convert from.

Skipped declarations

4 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

LinkMetadata.media(_:as:)

The iOS SDK compiler rejected this binding: cannot find type 'CoreTransferable' in scope

LinkMetadata.containsMedia(_:exportableAs:)

Passing a Swift type itself is not supported.

LinkMetadata.setMedia(_:for:)

This protocol needs associated types that cannot yet cross the bridge.

LinkMetadata.transferRepresentation

This protocol needs associated types that cannot yet cross the bridge.

All LinkPresentation types →