Is there any reason to UICollectionViewFlowLayout if we already have UICollectionViewCompositionalLayout?

Hi all,

Recently, I notice that by using UICollectionViewCompositionalLayout, we can achieve same outcome as UICollectionViewFlowLayout, but with less code.

An advantage of using UICollectionViewCompositionalLayout is that, it requires less code, as shown in this discussion thread

https://stackoverflow.com/a/51231881/72437

I was wondering, in all our upcoming new code, should we always prefer UICollectionViewCompositionalLayout over UICollectionViewFlowLayout? As, it is more powerful and required less code to implement.

Is there any reason we want to use UICollectionViewFlowLayout in our new code?

Thanks.
Answered by agilemind in 631963022
You would use the compositional layout if you're targeting iOS 13+ (flow layout if you need to support lower iOS versions)
Accepted Answer
You would use the compositional layout if you're targeting iOS 13+ (flow layout if you need to support lower iOS versions)
Is there any reason to UICollectionViewFlowLayout if we already have UICollectionViewCompositionalLayout?
 
 
Q