Hi all,
I encountered a weird behavior today : I've got a collectionView, a struct file (with the proper Hashable protocol implemented). Everything works fine ... the first time.
When my model changes, I trigger a reload using the same code as the first time :
I do enter in the datasource'z completion block. The cell is dequeued, I do enter in the configure method (where I change some stuff). My model is properly updated too.
If I log the model in the configure method, I do have the good values ... but the cells are never updated
How can a cell can be updated and configured and not update visually ?
Thanks
I encountered a weird behavior today : I've got a collectionView, a struct file (with the proper Hashable protocol implemented). Everything works fine ... the first time.
When my model changes, I trigger a reload using the same code as the first time :
Code Block datasource.apply(snap, animatingDifferences: animatingDifferences, completion: completion)
I do enter in the datasource'z completion block. The cell is dequeued, I do enter in the configure method (where I change some stuff). My model is properly updated too.
Code Block let dataSource = DataSource(collectionView: collectionView) { [weak self] (collection, indexPath, model) -> UICollectionViewCell? in guard let cell: VehicleCell = collectionView.automaticallyDequeueReusableCell(forIndexPath: indexPath) else { return nil } cell.configure(model) cell.vehicleDelegate = self?.vehicleDelegate return cell }
Code Block func configure(_ vehicle: Vehicle) { self.vehicle = vehicle print("🚖 \(vehicle.model) - \(vehicle.isCurrentVehicle ? "👍" : "👹")") }
If I log the model in the configure method, I do have the good values ... but the cells are never updated
Code Block 🚖 Coupé Série 1 - 👹 🚖 207SW - 👍 🚖 207SW - 👍 🚖 Coupé Série 1 - 👹 🚖 Coupé Série 1 - 👍 🚖 207SW - 👹 🚖 Coupé Série 1 - 👹 🚖 207SW - 👍
How can a cell can be updated and configured and not update visually ?
Thanks