setMedia(_:for:)
Sets the media data in the metadata for an attachment.
Declaration
nonisolated mutating func setMedia(_ media: some Transferable, for attachment: LinkMetadata.Attachment)Parameters
- media:
The value to use for the media that corresponds to the specified attachment.
- attachment:
The kind of attachment to modify, such as
.image,.icon, and.video.
Discussion
For example, a custom image can be set on some metadata:
metadata.setMedia(myImage, for: .image)