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 async, and onFinishedOpening will be called once the edition is going to be actually presented. The edition must be previously downloaded (see downloadEdition) or this method will fail with OpenError.Cause.editionNotDownloaded. If the edition is stale for some reason and it is not found, then the method will fail with OpenError.Cause.editionNotFound.

    Optionally, you can use sourceView and sourceImage to provide a seamless animation from sourceImage to the edition being presented. Typically an UIImageViewshowing the cover of the edition.

    presenterViewController is the presenter view controller, usually the view controller from where the user opens the edition.

    Declaration

    Swift

    func openEdition(
        edition: Edition,
        presenterViewController: UIViewController,
        sourceView: UIView?,
        sourceImage: UIImage?,
        onFinishedOpening: @escaping (OpenError?) -> Void
    )
  • Same as the method above but you can specify the page the edition will be opened at. 1 represents the cover page.

    Declaration

    Swift

    func openEdition(
        edition: Edition,
        presenterViewController: UIViewController,
        sourceView: UIView?,
        sourceImage: UIImage?,
        page: Int,
        onFinishedOpening: @escaping (OpenError?) -> 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 return nil.

    Declaration

    Swift

    func downloadEdition(
        edition: Edition,
        downloadProgressListener: DownloadProgressListener
    ) -> Cancelable?