I have a problem with implementing a UITableView using RxSwift.
I tried to bind an observable of an array of models to the table items with the following code.
models.bind(to: self.tableView.rx.items(cellIdentifier: "Cell", cellType: ModelTableViewCell.self.
But when I do it gives me the following error: Type 'inout UITableView' does not conform to protocol 'ReactiveCompatible' and I know the error can't be right because NSObject extends ReactiveCompatible so UITableView also does. Also, my project code isn't really different than the examples shown on RxSwiftCommunity
I created a small example project that has the error.
![[Example code showing the error (picture)]](https://i.sstatic.net/WSQgP.png)
Swift is quite good language but sometimes happens moments when compiler couldn't recognize the type of parameters. Then you need to explicit define a type of arguments. In your case you need to define the type of block arguments, see the code:
func bindRx(viewModel: ViewModel) {
viewModel.models.bind(to: tableView.rx.items(cellIdentifier: ModelTableViewCell.ReuseIdentifier,
cellType: ModelTableViewCell.self)) { (_, model: Model, cell: ModelTableViewCell) in
cell.textLabel?.text = model.name
}
.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