Skip to content
This repository was archived by the owner on Jun 17, 2023. It is now read-only.

Commit ef46c75

Browse files
committed
improve visibleRect variable
1 parent 90d2835 commit ef46c75

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

Lib/CollectionViewPagingLayout.swift

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ public class CollectionViewPagingLayout: UICollectionViewLayout {
3939
}
4040

4141
private var visibleRect: CGRect {
42-
guard let collectionView = collectionView else {
43-
return .zero
44-
}
45-
return CGRect(origin: collectionView.contentOffset, size: collectionView.bounds.size)
42+
collectionView.map { CGRect(origin: $0.contentOffset, size: $0.bounds.size) } ?? .zero
4643
}
4744

4845
private var numberOfItems: Int {

0 commit comments

Comments
 (0)