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)