In RxSwift example this works:
viewModel.rows
.bindTo(resultsTableView.rx_itemsWithCellIdentifier("WikipediaSearchCell")) { (_, viewModel, cell: WikipediaSearchCell) in
cell.viewModel = viewModel
}
.addDisposableTo(disposeBag)
How to write it using rx_itemsWithCellFactory?
It took me a while to get it, and no help from google yet. I hope it'll save you few minutes
viewModel.rows
.bindTo(resultsTableView.rx_itemsWithCellFactory){
(tv, i, vm) in
let indexPath = NSIndexPath(forItem: i, inSection: 0)
let cell = tv.dequeueReusableCellWithIdentifier("WikipediaSearchCell", forIndexPath: indexPath) as! WikipediaSearchCell
cell.viewModel = vm
return cell as UITableViewCell
}
.addDisposableTo(disposeBag)
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