User17373928
User17373928

Reputation: 29

How to use tableView's datasource (numberOfRowsInSection) wirh RxSwift?

I'm using RxSwift, RxCocoa for my app and implemented a tableView.
When It got priceData from viewModel for tableView, it showed full list of priceData.

But I want to show only 50 counts at the first time and show more when I scroll it.
Without RxSwift/RxCocoa, I used numberOfRowsInSection for paging of tableView.

But I don't know how I can use this with RxSwift

Here is my code. what should I do with my code for making to pageable tableView?

viewModel.priceData         
            .drive(tableView.rx.items(cellIdentifier: "Cell")) { (index: Int, list, cell: Cell) in
...
}.disposed(by: disposeBag)

Upvotes: 1

Views: 921

Answers (1)

Daniel T.
Daniel T.

Reputation: 33979

The RxDataSources library allows you to section your data. Add it to your project and you can use sections.

Upvotes: 1

Related Questions