Thank you for prompt response!
The layout code is following:
private func createLayoutforBottomCollectionView() -> UICollectionViewLayout {
let layout = UICollectionViewCompositionalLayout { section, enviroment in
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: ViewController.badgeElementKind, containerAnchor: badgeAnchor)
let itemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1.0), heightDimension: .fractionalHeight(1.0))
let item = NSCollectionLayoutItem(layoutSize: itemSize, supplementaryItems: [badge])
let groupSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(0.21), heightDimension: .fractionalHeight(0.4))
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])
let section = NSCollectionLayoutSection(group: group)
section.contentInsets = NSDirectionalEdgeInsets(top: 5, leading: 5, bottom: 5, trailing: 5)
section.interGroupSpacing = 10
section.orthogonalScrollingBehavior = .continuous
return section
}
return layout
}
Actually is the same as in the sample app "ImplementingModernCollectionViews" but I just added .orthogonalScrollingBehavior.
I´ve tested it in a separate app with two sections and this was the result:
My iOS is Big Sur 11.5.1