To start off the coding session for this section, we'll go through the process of setting up our UICollectionViewDiffableDatasource object. This is quite simple to setup once you know what kind of sections you'll have and what items you want per section. To make this easy, we'll simply set up the top section of social apps.
Comments (3)
jsayer7
3 years ago
Is `collectionView.dataSource = diffableDataSource` necessary? I've played around with the API in a few personal playground apps and I've never added that. I commented out that line from the file and it still seemed to work fine.. But I could obviously be totally wrong.
Brian Voong
3 years ago
jsayer7
3 years ago
I’m guessing it’s when you declare the diffable data source you pipe in the collection view, indexPath, and generic object type. You pass in the collectionView it’s linked to.
Hadouryu
3 years ago
Hey Brian, great videos. I was wondering if it's possible to provide more than one object type in the diffable data source constructor?
frankusu
3 years ago
my SwiftUI preview broke and I realized I forgot to comment out numberOfSections or return 0 in case anyone has the same problem