EditionPresenter
public protocol EditionPresenter
Interface for downloading and presenting editions to the user.
-
Use this method to present an edition for reading to the user. It will present a new view controller.
The method is asynchronous, and
onFinishedOpening
will be called once the edition is going to be actually presented. The edition must be previously downloaded (seedownloadEdition
) or this method will fail withOpenError.Cause.editionNotDownloaded
. If theedition
is stale for some reason and it is not found, then the method will fail withOpenError.Cause.editionNotFound
.Optionally, you can use
sourceView
andsourceImage
to provide a seamless animation fromsourceImage
to the edition being presented. Typically anUIImageView
showing the cover of the edition.presenterViewController
is the presenter view controller, usually the view controller from where the user opens the edition. -
openEdition(edition:
Default implementationpresenterViewController: sourceView: sourceImage: page: onFinishedOpening: closeHandler: ) Same as
openEdition(edition:presenterViewController:sourceView:sourceImage:onFinishedOpening:)
but you can specify the page the edition will be opened at. 1 represents the cover page.Default Implementation
Declaration
Swift
@MainActor func openEdition( edition: Edition, presenterViewController: UIViewController, sourceView: UIView?, sourceImage: UIImage?, page: EditionPageNumber, onFinishedOpening: @escaping (OpenError?) -> Void, closeHandler: ((UIViewController) -> Void)? )
-
Use this method to download an edition and make it available for presentation.
Download progress is provided through
downloadProgressListener
Returns a
Cancelable
instance, so the download can be cancelled through it. If the edition can’t be found, or if it is already downloaded the method will returnnil
.Declaration
Swift
@MainActor func downloadEdition( edition: Edition, downloadProgressListener: DownloadProgressListener ) -> Cancelable?