Skip to content

Commit 07f2761

Browse files
committed
fix tap handler called on multiple cells
1 parent 46cbf7f commit 07f2761

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Sources/CollectionView.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,12 @@ open class CollectionView: UIScrollView {
7676
}
7777

7878
@objc func tap(gesture: UITapGestureRecognizer) {
79-
for identifier in visibleIdentifiers {
79+
for identifier in visibleIdentifiers.reversed() {
8080
let cell = identifierToView[identifier]!
8181
let index = identifierToIndex[identifier]!
8282
if cell.point(inside: gesture.location(in: cell), with: nil) {
8383
provider.didTap(view: cell, at: index)
84+
return
8485
}
8586
}
8687
}

0 commit comments

Comments
 (0)