Layouts and sections
Arrange collection data as lists, grids, carousels, and mixed section layouts.
CollectionLayout selects one of three native arrangements:
Lists use full-width rows. The grouped form uses UIKit's inset-grouped appearance. Grids divide the available width into equal columns. Carousels scroll horizontally with a fixed item width.
The item source and cell-template setup is covered in data and templates.
Carousel snapping
CarouselSnap.None allows free scrolling. Boundary modes stop at leading boundaries, item modes settle on individual items, ItemCentered centers one, and Page moves by a viewport at a time. The Peek variants leave part of the previous item visible to communicate that the row scrolls.
Mixed sections
A grouped collection can choose a layout for every section:
All sections share one ItemTemplate; adapt the cell through its bound item or OnItemChanged. Header and footer templates bind to the section model.
Expandable sections
Implement IExpandableSection<TItem> to give a section an IsExpanded property. Its header receives the native disclosure treatment and toggles that state when selected. The section model must notify or otherwise participate in the collection update path used by the source.
List presentation
ShowsSeparators controls list row separators. SeparatorInsets sets leading and trailing insets; it has no effect on grid and carousel layouts.
For a grouped list with a fast-scroll index, set SectionIndexTitle to map each section to its label. IndexTitles can supply an explicit index sequence. Tapping a title scrolls to its matching section or the nearest following section.
For snapshot refreshes, selection, and programmatic scrolling, see updates and selection.