I am making an app that is using compositional layout for the collectionview I'm having a carrousel layout that display elements horizontally.
let itemSize = NSCollectionLayoutSize(widthDimension: .absolute(100), heightDimension: .absolute(100))
let item = NSCollectionLayoutItem(layoutSize: itemSize)
item.contentInsets = NSDirectionalEdgeInsets(top: 2, leading: 2, bottom: 2, trailing: 2)
let groupSize = NSCollectionLayoutSize(widthDimension: .absolute(100), heightDimension: .fractionalWidth(1 / 3))
let group = NSCollectionLayoutGroup.horizontal(layoutSize: groupSize, subitems: [item])
group.contentInsets = .init(top: 4, leading: 0, bottom: 4, trailing: 0)
let section = NSCollectionLayoutSection(group: group)
section.orthogonalScrollingBehavior = .continuous
How can I achieve infinite scrolling meaning that every time we get the last element it goes back to the first element and continue to scroll? (for now it works, I can scroll element but every time the last element is displayed I have to scroll back the other way)
I have seen many way to achieve this with the old collectionview system, but I wanna keep using the new way please