Skip to content

Commit f536d6e

Browse files
committed
Improves collection view partial updates throttling logic.
1 parent bf63b81 commit f536d6e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Podfile.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ EXTERNAL SOURCES:
1717

1818
CHECKOUT OPTIONS:
1919
RxCocoa:
20-
:commit: 979f3723e43cf5e340818142baca15b3b37ec351
20+
:commit: 4a36de8a2452b2cee62bc5cb8a5376e755f2d8e7
2121
:git: [email protected]:ReactiveX/RxSwift.git
2222
RxSwift:
23-
:commit: 979f3723e43cf5e340818142baca15b3b37ec351
23+
:commit: 4a36de8a2452b2cee62bc5cb8a5376e755f2d8e7
2424
:git: [email protected]:ReactiveX/RxSwift.git
2525

2626
SPEC CHECKSUMS:

Sources/DataSources+Rx/RxCollectionViewSectionedAnimatedDataSource.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,19 @@ public class RxCollectionViewSectionedAnimatedDataSource<S: AnimatableSectionMod
2929

3030
private let disposeBag = DisposeBag()
3131

32+
// This subject and throttle are here
33+
// because collection view has problems processing animated updates fast.
34+
// This should somewhat help to alleviate the problem.
3235
private let partialUpdateEvent = PublishSubject<(UICollectionView, Event<Element>)>()
3336

3437
public override init() {
3538
super.init()
3639

3740
self.partialUpdateEvent
41+
// so in case it does produce a crash, it will be after the data has changed
42+
.observeOn(MainScheduler.asyncInstance)
43+
// Collection view has issues digesting fast updates, this should
44+
// help to alleviate the issues with them.
3845
.throttle(0.5, scheduler: MainScheduler.instance)
3946
.subscribe(onNext: { [weak self] event in
4047
self?.collectionView(event.0, observedPartialUpdateEvent: event.1)

0 commit comments

Comments
 (0)