2

With Bond 4.x it was possible to pass my custom data source when binding a tableview to an ObservableArray in order to implement custom invocations of UICollectionViewDataSource methods (e.g. viewForSupplementaryElementOfKind) like this:

viewModel.dataSource.bindTo(collectionView, proxyDataSource: HeaderViewCreator()) { indexPath, dataSource, tableView

This is gone now in Bond5 as trying to use the proxyDataSource parameter causes a compiler error expecting a different argument label in the call.

Unfortunately I could not find a proper section in the migration guide and also I had a hard time understanding the documentation in that regard. BNDTableViewProxyDataSource and friends seem to be gone completely from the codebase.

Thanks for any kind of help!

MrBr
  • 1,884
  • 2
  • 24
  • 38

1 Answers1

1

UITableView and UICollectionView now have properties bnd_delegate and bnd_dataSource of type ProtocolProxy. That type has a property forwardTo that you can set to receive delegate or data source callbacks that are not used by ProtocolProxy (i.e. Bond).

For example:

class MyViewController: UITableViewDelegate {

  var tableView: UITableView

  func viewDidLoad() {
    super.viewDidLoad()
    tableView.bnd_delegate.forwardTo = self
  }
}
Srđan Rašić
  • 1,597
  • 15
  • 23