Skip to content
This repository has been archived by the owner on Nov 26, 2020. It is now read-only.

Add pageDidLoad() method to the reader center delegate #153

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Source/FolioReaderCenter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ var isScrolling = false
/// Protocol which is used from `FolioReaderCenter`s.
@objc public protocol FolioReaderCenterDelegate: class {

/**
Notifies that page did load. A page load doesn't mean that this page is displayed right away, use `pageDidAppear` to get informed about the appearance of a page.

- parameter page: The loaded page
*/
optional func pageDidLoad(page: FolioReaderPage)

/**
Notifies that a page appeared. This is triggered is a page is chosen and displayed.

Expand Down Expand Up @@ -1119,6 +1126,9 @@ extension FolioReaderCenter: FolioReaderPageDelegate {
let offsetPoint = self.currentWebViewScrollPositions[page.pageNumber - 1] {
page.webView.scrollView.setContentOffset(offsetPoint, animated: false)
}

// Pass the event to the reader center delegate
delegate?.pageDidLoad?(page)
}
}

Expand Down