CombineCommunity / CombineCocoa

Combine publisher bridges for UIKit
MIT License
1.67k stars 133 forks source link

`reachedBottomPublisher` offset not working as expected. #89

Open markst opened 11 months ago

markst commented 11 months ago

Appears the UIScrollView.reachedBottomPublisher offset is not working as expected.

Currently the threshold is calculated by using max bracketing on offset of calculating the y to compare using visible height:

let threshold = max(offset, self.contentSize.height - visibleHeight)

However in order for this to work the publisher would have to be setup as:

collectionView
  .reachedBottomPublisher(collectionView.contentSize.height - visibleHeight - offset)
  .sink {

Which I don't believe is correct given when dynamically inserting content the content size will change.

markst commented 11 months ago

I believe the threshold needs to be calculated considering the offset such as:

let threshold = (self.contentSize.height - visibleHeight) - offset