How to create dynamic number of sections in diffable UICollectionView?

327 views Asked by At

I know there is a way to decide the number of sections later on if we use the UICollectionView datasource.

func numberOfSections(in collectionView: UICollectionView) -> Int

Just want to know are there any way for diffable datasource?

1

There are 1 answers

0
vadian On BEST ANSWER

The diffable data sources in UIKit and AppKit are declarative.

This means the framework doesn't ask you for the number of sections, instead you tell the framework the number of sections while preparing the NSDiffableDataSourceSnapshot.