Hey I'm trying to get an UICollectionView, hosted by an UICollectionViewController working with RxCocoa and RxDataSources.
Everything works fine when I use an UIViewController, with an embedded UICollectionView.
But when I try to connect via the same logic:
self.vm.sections
.bind(to: self.collectionView!.rx.items(dataSource: self.vm.data))
.disposed(by: self.bag)
with an UICollectionView inside an UICollectionViewController, Xcode crashes completely.
Is there something I'm missing about RxDataSources, that you cannot use them with UICollectionViewController?
Though I have no idea about why Xcode crashes, it seems to be caused by RxCocoa's assertion checking.
The data source of UICollectionViewController's collectionView is set by default.
How about setting it to nil before binding with observable?
self.collectionView!.dataSource = nil
self.vm.sections
.bind(to: self.collectionView!.rx.items(dataSource: self.vm.data))
.disposed(by: self.bag)
If you inherit from UITableViewController you must call tableView.datasource = nil anytime you are doing a whole table reload or refresh action
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