EditionCoverProvider
@MainActor
public protocol EditionCoverProvider
Interface to get the cover for a edition as an image.
The SDK keeps a cache, so it is safe to call these methods in offline mode. If the network fails or can’t be
accessed the SDK will use any cached image available, even if it needs to upscale to satisfy boundingBoxSize
parameters passed to the methods.
-
This method provides an
UIImagewith the cover of an edition given a size throughboundingBoxSizein points. The cover size is guaranteed to fit inboundingBoxSize.coverSizecan be used if you need to calculate an exact size to pass inboundingBoxSize.The cover is provided through the the
completioncallback.The method returns a
Cancelablethat can be used to cancel the operation. If the operation is canceled,completionwill be called withcanceled.Declaration
Swift
@MainActor func coverImageForEdition( edition: Edition, boundingBoxSize: CGSize, completion: @escaping (_ result: Result<UIImage, Error>) -> Void ) -> any Cancelable -
Create a
StartableCancelablefor loading the cover image for an edition.Declaration
Swift
@MainActor func startableCoverImageForEdition( edition: Edition, boundingBoxSize: CGSize ) -> StartableResultProvider<UIImage, any Error>Parameters
editionThe edition whose cover to load.
boundingBoxSizeDefine the size in which to fit the cover image. You can use
coverSizefor calculating this value.Return Value
A
StartableCancelablethat can be used to start the operation and to cancel it. Cancelling the the operation will cause the completion block passed to the start method to be called withcanceled. -
coverImageForEdition(edition:Extension method, asynchronousboundingBoxSize: ) Asynchronously load the cover image for an edition. The operation supports task cancellation. The error thrown upon cancellation is
canceled.Declaration
Swift
@MainActor func coverImageForEdition( edition: Edition, boundingBoxSize: CGSize ) async throws -> UIImageParameters
editionThe edition whose cover to load.
boundingBoxSizeDefine the size in which to fit the cover image. You can use
coverSizefor calculating this value.