From 4ac4cfa4bbdae60e909f7d5160b23426d50aa92f Mon Sep 17 00:00:00 2001 From: Hans Seiffert Date: Thu, 22 Sep 2016 04:05:23 +0200 Subject: [PATCH] Add `pageDidLoad()` method to the reader center delegate (#153) --- Source/FolioReaderCenter.swift | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Source/FolioReaderCenter.swift b/Source/FolioReaderCenter.swift index 5597c7b26..70fd7bd51 100755 --- a/Source/FolioReaderCenter.swift +++ b/Source/FolioReaderCenter.swift @@ -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. @@ -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) } }