apptekstudios / ASCollectionView

A SwiftUI collection view with support for custom layouts, preloading, and more.
MIT License
1.36k stars 160 forks source link

How to apply both UICollectionViewLayout and UICollectionViewCompositionalLayout in sections in the same ASCollectionView? #201

Closed zhulmin closed 3 years ago

zhulmin commented 3 years ago

How to apply both UICollectionViewLayout and UICollectionViewCompositionalLayout in sections in the same ASCollectionView?

Just like the code below

ASCollectionView().layout {section in 
if section == 0 {
 //UICollectionViewCompositionalLayout  
    return .grid(layoutMode: .adaptive(withMinItemSize: 100),
                  itemSpacing: 5,
                  lineSpacing: 5,
                  itemSize: .absolute(50))
}else {
//UICollectionViewLayout
    return  ASWaterfallLayout.init() 

    // or like it
    //return ASCollectionViewSection {
    //...
    //let layout = ASWaterfallLayout.init() 
    //...
    //}
}
zhulmin commented 3 years ago

resolve