At the WWDC 2019, Apple introduced a new form of UICollectionViewLayout. A new UICollectionViewCompositionalLayout class has been added to UIKit to make it easier to create compositional layouts without requiring a custom UICollectionViewLayout.
In iOS 12 and earlier, we need subclassing of UICollectionViewLayout to do that. We have to override lots of methods correctly, and it is error-prone.
With Collection View Compositional Layouts, you can make very complex layout even nested collection views with independently scrolling sections just within few lines of code.
Features:
- Inter Item Spacing
- Inter Group Spacing
- Inter Section Spacing
- Fixed Spacing
- Flexible Spacing
- Nested Groups
- Vertical Scrolling
- Horizontal Scrolling
- Supplemental Views (e.g. Section Header/Footers)
- Pinned Section Header/Footers
- Decoration Views (e.g. Background Views)
- Orthogonal Scrolling
- Orthogonal Scrolling Behavior
- Estimated Size (Autosizing)
- Custom Group Item (Absolute Positions)
- Drop-in replacement

Leave a Reply
You must be logged in to post a comment.