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

Commit b12ef5e

Browse files
committed
Cache numberOfItems
1 parent e7f6a32 commit b12ef5e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Lib/CollectionViewPagingLayout.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public class CollectionViewPagingLayout: UICollectionViewLayout {
7272

7373
override public func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
7474
let currentScrollOffset = self.currentScrollOffset
75+
let numberOfItems = self.numberOfItems
7576
let attributesCount = numberOfVisibleItems ?? numberOfItems
7677
let visibleRangeMid = attributesCount / 2
7778
let currentPageIndex = Int(round(currentScrollOffset))

0 commit comments

Comments
 (0)