So I've just recently playing around with Compositional Layouts with Diffable DataSource and so far loving it. But all of my endeavors have included a single type of Data Item.
What I'm trying to achieve is have two different types of List, say Car
and Airplane
So far what I've done is created the layouts, created an Enum
enum DataItem: Hashable{
case cars(Car)
case airplane(Airplane)
}
Run Code Online (Sandbox Code Playgroud)
And dataSource initialization:
func configureDataSource(){
dataSource = UICollectionViewDiffableDataSource
<Section, DataItem>(collectionView: collectionView) {
(collectionView: UICollectionView, …
Run Code Online (Sandbox Code Playgroud)