When using traditional UICollectionView, we often use the following code to handle empty state:
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
if items.count == 0 {
// Display empty view
} else {
// Display collection view
}
return items.count
}
How to approach state handling while using diffable data sources in UICollectionView or UITableView?