Skip to content

Commit e5fbefa

Browse files
humblehackerlkzhao
authored andcommitted
Fix unexpected UIScrollView behavior (#77)
This change ensures that the swizzled logic only applies to CollectionView and its subclasses. I discovered this after experiencing unexpected behavior in an unrelated UIScrollView subclass after adding a CollectionView to my project.
1 parent adbb08d commit e5fbefa

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Sources/Other/CollectionReloadable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ internal class CollectionViewManager {
5757
// this swizzling fixed the issue. where the scrollview would jump during scroll
5858
extension UIScrollView {
5959
@objc func collectionKitAdjustContentOffsetIfNecessary(_ animated: Bool) {
60-
guard !isDragging && !isDecelerating else { return }
60+
guard !(self is CollectionView) || !isDragging && !isDecelerating else { return }
6161
self.perform(#selector(CollectionView.collectionKitAdjustContentOffsetIfNecessary))
6262
}
6363

0 commit comments

Comments
 (0)