'How to know that horizontal collectionView section did end decelerating?

I have a vertically scrolling collectionView where sections are scroll horizontally. How to know that section did end decelerating? If I use

func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
        
    }

delegate just says me about vertical scrolling.



Solution 1:[1]

If you are using Compositional Layout, you can achieve this kind of horizontal scroll logic via visibleItemsInvalidationHandler inside NSCollectionLayoutSection.

Like here:

sectionLayout.visibleItemsInvalidationHandler = { [weak self] items, contentOffset, environment in
        // Here you can add some code to handle some kind of logic using contentOffset
    }

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 Pete Streem