Is there any way to add a badge NSCollectionLayoutSupplementaryItem) to a UICollectionLayoutListConfiguration?
I'm trying to implement a sidebar using Modern Collection Views:
var configuration = UICollectionLayoutListConfiguration(appearance: .sidebar)
...
let section = NSCollectionLayoutSection.list(using: configuration, layoutEnvironment: layoutEnvironment)
but I can't find how to implement the badge configuration:
let badgeAnchor = NSCollectionLayoutAnchor(edges: [.top, .trailing], fractionalOffset: CGPoint(x: 0.3, y: -0.3))
let badgeSize = NSCollectionLayoutSize(widthDimension: .absolute(20),
heightDimension: .absolute(20))
let badge = NSCollectionLayoutSupplementaryItem(
layoutSize: badgeSize,
elementKind: "badge",
containerAnchor: badgeAnchor)
like the example code Apple provides:
let item = NSCollectionLayoutItem(layoutSize: itemSize, supplementaryItems: [badge])
(the example code that Apple provides, crashes btw)
Any ideas on how to implement the badge to UICollectionLayoutListConfiguration or is not possible?