This repository was archived by the owner on Jun 17, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Expand file tree Collapse file tree 1 file changed +3
-6
lines changed Original file line number Diff line number Diff line change @@ -171,10 +171,10 @@ public class CollectionViewPagingLayout: UICollectionViewLayout {
171
171
172
172
// MARK: Private functions
173
173
174
- private func updateCurrentPageIfNeeded( basedOn contentOffset : CGPoint ? = nil ) {
174
+ private func updateCurrentPageIfNeeded( ) {
175
175
var currentPage : Int = 0
176
176
if let collectionView = collectionView {
177
- let contentOffset = contentOffset ?? collectionView. contentOffset
177
+ let contentOffset = collectionView. contentOffset
178
178
let pageSize = scrollDirection == . horizontal ? collectionView. frame. width : collectionView. frame. height
179
179
let offset = scrollDirection == . horizontal ?
180
180
( contentOffset. x + collectionView. contentInset. left) :
@@ -212,10 +212,7 @@ public class CollectionViewPagingLayout: UICollectionViewLayout {
212
212
let contentOffset : CGPoint = scrollDirection == . horizontal ? CGPoint ( x: offset, y: 0 ) : CGPoint ( x: 0 , y: offset)
213
213
CATransaction . begin ( )
214
214
CATransaction . setCompletionBlock { [ weak self] in
215
- self ? . updateCurrentPageIfNeeded ( basedOn: contentOffset)
216
- }
217
- if !animated {
218
- updateCurrentPageIfNeeded ( basedOn: contentOffset)
215
+ self ? . invalidateLayout ( )
219
216
}
220
217
collectionView? . setContentOffset ( contentOffset, animated: animated)
221
218
CATransaction . commit ( )
You can’t perform that action at this time.
0 commit comments