I'w wonder is there any code example for RxSwift
when I can use multiple custom cells inside one table view. So for example I have two section and first section has 10 cells with type CellWithImage
identifier and second section has 10 cells with type CellWithVideo
identifier.
All tuts and code examples which I've founded are using only one cell type, for instance RxSwiftTableViewExample
Thanks for any help
You can set multiple custom cell without RxDatasource.
//Register Cells as you want tableView.register(CustomRxTableViewCell.self, forCellReuseIdentifier: "Cell") tableView.register(UITableViewCell.self, forCellReuseIdentifier: "BasicCell") ViewModel.data.bind(to: tableView.rx.items){(tv, row, item) -> UITableViewCell in if row == 0 { let cell = tv.dequeueReusableCell(withIdentifier: "BasicCell", for: IndexPath.init(row: row, section: 0)) cell.textLabel?.text = item.birthday return cell }else{ let cell = tv.dequeueReusableCell(withIdentifier: "Cell", for: IndexPath.init(row: row, section: 0)) as! CustomRxTableViewCell cell.titleLb.text = item.name return cell } }.disposed(by: disposeBag)
I've managed it using RxSwiftDataSources,
it allow you to use custom cells with multi sections. I've used this code for help
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With