---
title: "init(id:artworkProvider:)"
framework: nowplaying
role: symbol
role_heading: Initializer
path: "nowplaying/artwork/init(id:artworkprovider:)"
---

# init(id:artworkProvider:)

Creates an artwork whose image data loads on demand at the requested size.

## Declaration

```swift
init(id: String, artworkProvider: @escaping @Sendable (CGSize) async throws -> ArtworkRepresentation)
```

## Parameters

- `id`: A unique identifier for this artwork.
- `artworkProvider`: A handler the system calls to request an doc://com.apple.nowplaying/documentation/NowPlaying/ArtworkRepresentation for a specified size.

## Discussion

Discussion The provider returns artwork that matches the requested size when possible. One dimension may differ if the artwork’s aspect ratio differs from the requested size. If the requested size exceeds the artwork’s maximum available size, the provider returns the artwork at its maximum size without enlarging the image.
