'UICollectionViewCompositionalLayout decorationItems excluding header and footer
The new UICollectionViewCompositionalLayout introduced in iOS 13 have a property named decorationItems for adding decoration items conveniently, which you could use to add a background for the section.
let section = NSCollectionLayoutSection(group: group)
section.decorationItems = [
NSCollectionLayoutDecorationItem.background(elementKind:"your identifier")
]
Which is working fine for the full section.
what I want is to add a decoration view only on items since I want rounded background only for section items excluding header and footer. could anyone help?
Solution 1:[1]
You can use a property contentInsets on NSCollectionLayoutDecorationItem in order to exclude header and footer
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Azat |
