diff --git a/Sources/FSPageViewLayout.swift b/Sources/FSPageViewLayout.swift index 59197a0..9477ac4 100644 --- a/Sources/FSPageViewLayout.swift +++ b/Sources/FSPageViewLayout.swift @@ -265,12 +265,11 @@ class FSPagerViewLayout: UICollectionViewLayout { guard let collectionView = self.collectionView, let pagerView = self.pagerView else { return } - let currentIndex = max(0, min(pagerView.currentIndex, pagerView.numberOfItems - 1)) + let currentIndex = pagerView.currentIndex let newIndexPath = IndexPath(item: currentIndex, section: pagerView.isInfinite ? self.numberOfSections/2 : 0) let contentOffset = self.contentOffset(for: newIndexPath) let newBounds = CGRect(origin: contentOffset, size: collectionView.frame.size) collectionView.bounds = newBounds - pagerView.currentIndex = currentIndex } fileprivate func applyTransform(to attributes: FSPagerViewLayoutAttributes, with transformer: FSPagerViewTransformer?) { diff --git a/Sources/FSPagerView.swift b/Sources/FSPagerView.swift index 7ee1e49..7fb17d9 100644 --- a/Sources/FSPagerView.swift +++ b/Sources/FSPagerView.swift @@ -214,7 +214,7 @@ open class FSPagerView: UIView,UICollectionViewDataSource,UICollectionViewDelega return self.collectionView.panGestureRecognizer } - @objc open internal(set) dynamic var currentIndex: Int = 0 + @objc open fileprivate(set) dynamic var currentIndex: Int = 0 // MARK: - Private properties