Swift: Compositional layout - orthogonal scrolling breaks sticky header

Viewed 304

I am currently struggling a bit while trying to create a sticky header for collection view using CompostionalLayout. In my collection view, one of the sections needs to scroll horizontally which requires for orthogonalScrollingBehavior of that section to be set to something other than default value (which is .none) This is how I am providing section header for the section:

case .liveEvents:
            let supplementaryItemSize = NSCollectionLayoutSize(widthDimension: .fractionalWidth(1), heightDimension: .absolute(Constants.timeFrameHeaderViewHeight))
            let supplementaryItem = NSCollectionLayoutBoundarySupplementaryItem(layoutSize: supplementaryItemSize, elementKind: "stickyHeader", alignment: .top)
            supplementaryItem.pinToVisibleBounds = true
            return supplementaryItem

This is how the final behavior looks like

enter image description here

It seems like the section header disappears after I start scrolling. If I change orthogonalScrollingBehavior of all sections to be .none the result looks like this. The header sticks just fine but the horizontally scrollable section is no longer horizontally scrollable.

enter image description here

Anybody ran into similar issue ?

0 Answers
Related