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
onFinishedOpeningwill 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 theeditionis stale for some reason and it is not found, then the method will fail withOpenError.Cause.editionNotFound.Optionally, you can use
sourceViewandsourceImageto provide a seamless animation fromsourceImageto the edition being presented. Typically anUIImageViewshowing the cover of the edition.presenterViewControlleris 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
downloadProgressListenerReturns a
Cancelableinstance, 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?