One Logo Pool Ball
_MusicKit_SwiftUI · IOS API REFERENCE

ArtworkImage

struct · iOS 15.0+ · SDK 27.1

@MainActor @preconcurrency struct ArtworkImage

A view that displays the image for a music item’s artwork. You can create an artwork image with an instance of <doc://com.apple.documentation/documentation/MusicKit/Artwork>. While the artwork’s image data is loading, ``ArtworkImage`` automatically displays a placeholder with a solid color that matches the <doc://com.apple.documentation/documentation/MusicKit/Artwork/backgroundColor> property of the artwork to render.

Members (3)

init · iOS 15.0+

init

TypeScript
static initWidthHeight(artwork: _MusicKit_Artwork, width: number, height: number): Promise<ArtworkImage>
Swift declaration
nonisolated init(_ artwork: Artwork, width: CGFloat, height: CGFloat)

Creates an instance with a specified width and height. This initializer derives the <doc://com.apple.documentation/documentation/Foundation/URL> for loading the artwork image from the <doc://com.apple.documentation/documentation/MusicKit/Artwork> instance and the specified sizing parameters, as well as the display scale for the current environment. The loaded image and placeholder have constrained frames from these sizing parameters.

init · iOS 15.0+

init

TypeScript
static initWidth(artwork: _MusicKit_Artwork, width: number): Promise<ArtworkImage>
Swift declaration
nonisolated init(_ artwork: Artwork, width: CGFloat)

Creates an instance with a specified width. This initializer derives the <doc://com.apple.documentation/documentation/Foundation/URL> for loading the artwork image from the <doc://com.apple.documentation/documentation/MusicKit/Artwork> instance and the specified sizing parameters, as well as the display scale for the current environment. The loaded image and placeholder have constrained frames from these sizing parameters. If you provide the width only, the artwork image calculates the height dimension as a proportional length according to the aspect ratio of the artwork.

init · iOS 15.0+

init

TypeScript
static initHeight(artwork: _MusicKit_Artwork, height: number): Promise<ArtworkImage>
Swift declaration
nonisolated init(_ artwork: Artwork, height: CGFloat)

Creates an instance with a specified height. This initializer derives the <doc://com.apple.documentation/documentation/Foundation/URL> for loading the artwork image from the <doc://com.apple.documentation/documentation/MusicKit/Artwork> instance and the specified sizing parameters, as well as the display scale for the current environment. The loaded image and placeholder have constrained frames from these sizing parameters. If you provide the height only, the artwork image calculates the width dimension as a proportional length according to the aspect ratio of the artwork.

Skipped declarations

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

ArtworkImage.body

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

All _MusicKit_SwiftUI types →