[英]How to use tableView's datasource (numberOfRowsInSection) wirh RxSwift?
I'm using RxSwift, RxCocoa for my app and implemented a tableView.我正在为我的应用程序使用RxSwift、RxCocoa并实现了一个 tableView。
When It got priceData from viewModel for tableView, it showed full list of priceData.当它从 tableView 的 viewModel 获取 priceData 时,它显示了 priceData 的完整列表。
But I want to show only 50 counts at the first time and show more when I scroll it.但我想在第一次只显示 50 个计数,并在滚动时显示更多。
Without RxSwift/RxCocoa, I used numberOfRowsInSection for paging of tableView .在没有 RxSwift/RxCocoa 的情况下,我使用 numberOfRowsInSection 对tableView进行分页。
But I don't know how I can use this with RxSwift但我不知道如何在 RxSwift 中使用它
Here is my code.这是我的代码。 what should I do with my code for making to pageable tableView?我应该如何处理我的代码来制作可分页的 tableView?
viewModel.priceData
.drive(tableView.rx.items(cellIdentifier: "Cell")) { (index: Int, list, cell: Cell) in
...
}.disposed(by: disposeBag)
The RxDataSources
library allows you to section your data. RxDataSources
库允许您对数据进行分段。 Add it to your project and you can use sections.将其添加到您的项目中,您就可以使用部分了。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.