Compositional layout API: Orthogonally scrollable sections should be customizable (deceleration rate, bouncing, scroll indicators)

Number:rdar://FB9556269 Date Originated:Aug 24, 2021
Status:Open Resolved:
Product:UIKit Product Version:
Classification:Suggestion Reproducible:
iOS 13 introduced the compositional layout API. One major feature of this API is the possibility to have sections scrolling orthogonally and independently. This is a great way to build layouts which were previously only possible by nesting collections views into other scrollable views (e.g. a table view).

One downside of this approach, though, is that you do not get access to the underlying orthogonal scroll views for further customization. On narrow layouts (iPhone, iPad split screen) it might be namely useful to increase the deceleration rate of such scroll views horizontally so that navigation between items is made more convenient by gently swiping from item to item, especially when snapping at item boundaries. Sometimes you might also want to make horizontal scroll views always bounce, even if all items horizontally fit, or to have the scroll view indicator visible.

Such customization would require an improvement of the existing compositional layout API. I am not sure that providing an underlying access to each collection view orthogonal scroll view directly (as a `UIScrollView`) would be a good idea as it breaks encapsulation. It might be better to:

- Identify the properties of `UIScrollView` which should be customizable for a compositional layout orthogonal section (e.g. `decelerationRate`, `indicatorStyle`, `alwaysBounceHorizontal`, etc.).
- Provide them as new customization properties on `NSCollectionLayoutSection`, maybe through a dedicated `NSCollectionLayoutOrthogonalSectionConfiguration` which applies only when `UICollectionLayoutSectionOrthogonalScrollingBehavior` is different from `.none`. This would make each section configurable separately as well, as the desired behavior might be different between sections.

Thank you very much in advance for considering this improvement, which would make the compositional layout even more flexible.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!