Contents

init(id:artworkProvider:)

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

Declaration

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 Artworkrepresentation for a specified size.

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.