Why does returning nil from
result n "the collection view's data source did not return a valid cell from"
Isn't the UICollectionViewCell optional?
Code Block UICollectionViewDiffableDataSource<FeedElement, Entity>(collectionView: collectionView) { (collectionView: UICollectionView, indexPath: IndexPath, entity: Entity) -> UICollectionViewCell? in
result n "the collection view's data source did not return a valid cell from"
Isn't the UICollectionViewCell optional?
The cell is optional just so that you can create proper switch of if...else cases in the block and don't have to create a face cell for something that is never hit. As with the old data source delegate methods, you have to return a valid cell when the collection view asks you to as this cell has a reserved spot in the layout and matches an existing entry in the data source, so it has to be represented somehow.