我正在try 实现分页.每当表格视图滚动时,我希望react 堆判断它是否到达底部.但是,无论什么时候发生tableView
‘S didScroll
,绑定reactor.action
似乎都是没有必要的.
所以我觉得还是用一个运算符来限制绑定reactor.action
比较好.但我不确定在这种情况下,.debounce
和.throttle
之间哪个运营商更合适.
self.tableView.rx.didScroll
.skip(1)
.withLatestFrom(self.tableView.rx.contentOffset)
.map { [weak self] in
print("didScroll")
return Reactor.Action.pagination(
contentHeight: self?.tableView.contentSize.height ?? 0,
contentOffsetY: $0.y,
scrollViewHeight: UIScreen.main.bounds.height
)
}
.bind(to: reactor.action)
.disposed(by: disposeBag)
我已经在我的代码中try 了.debounce
和.throttle
.但我仍然不确定哪一种更合适.