RxCollectionViewSectionedAnimatedDataSource lost one cell
didanoff opened this issue · comments
didanoff commented
I have:
let dataSource = RxCollectionViewSectionedAnimatedDataSource<CatListSection>(configureCell: {
dataSource, collectionView, indexPath, item in
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CatListCollectionViewCell.identifier,
for: indexPath) as! CatListCollectionViewCell
return cell
})
struct CatListSection {
var header:String
var items:[Item]
var uniqueId: String = "Cats"
}
extension CatListSection: AnimatableSectionModelType {
typealias Item = Cat
typealias Identity = String
init(header: String, items: [Item]) {
self.header = header
self.items = items
}
init(original: CatListSection, items: [Item]) {
self = original
self.items = items
}
var identity: String {
return uniqueId
}
}
viewModel.newCatsObservable
.bind(to: catListCollectionView.rx.items(dataSource: dataSource))
.disposed(by: disposeBag)
During start I send to newCatsObservable
10 items.
func collectionView(_ collectionView: UICollectionView, willDisplay cell: UICollectionViewCell, forItemAt indexPath: IndexPath) {
if indexPath.row == viewModel.catsCount - 2 {
viewModel.loadNewCats() // Send next 10 items
}
}
And in collection view I see one lost cell:
Why it happens?