From db5a6a009897f083898fc653c2cbfc65d805bb88 Mon Sep 17 00:00:00 2001 From: kangnux Date: Sat, 7 Oct 2023 23:51:00 +0900 Subject: [PATCH] fix display for only one page --- Sources/ContentScrollView.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/ContentScrollView.swift b/Sources/ContentScrollView.swift index a6c8b11..b3ad165 100644 --- a/Sources/ContentScrollView.swift +++ b/Sources/ContentScrollView.swift @@ -30,7 +30,11 @@ open class ContentScrollView: UIScrollView { return min(lastIndex, i) }() - guard nextPageIndex > previousPageIndex else { return nil } + // MARK: 見えるページビューの判定 + /// - ページが一つしかない場合、`nextPageIndex`と`previousPageIndex`は等しくて共に`0`と想定されます。 + /// - 複数のページがある場合、`preloadingPageCount`が`0`の場合:`nextPageIndex`と`previousPageIndex`は等しいと想定されます。 + /// - 複数のページがある場合、`preloadingPageCount`が`1`以上の場合:`nextPageIndex`は`previousPageIndex`より大きいと想定されます。 + guard nextPageIndex >= previousPageIndex else { return nil } return previousPageIndex...nextPageIndex }