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)