UICollectionLayoutListConfiguration
A configuration for creating a list layout.
Declaration
struct UICollectionLayoutListConfigurationOverview
Use this configuration to create a list section for a compositional layout (UICollectionViewCompositionalLayout), or a layout containing only list sections. The following example shows how to create a compositional layout that contains only list sections by applying the same configuration to each section in the list layout:
let configuration = UICollectionLayoutListConfiguration(appearance: .sidebar)
let layout = UICollectionViewCompositionalLayout.list(using: configuration)To implement different list configurations for different sections, use a compositional layout’s section provider to create each section with its own list configuration.
let layout = UICollectionViewCompositionalLayout() { sectionIndex, layoutEnvironment in
var configuration = UICollectionLayoutListConfiguration(appearance: .insetGrouped)
configuration.headerMode = sectionIndex == 0 ? .supplementary : .none
let section = NSCollectionLayoutSection.list(using: configuration,
layoutEnvironment: layoutEnvironment)
return section
}Topics
Creating a list layout configuration
Configuring appearance
Configuring separators
showsSeparatorsseparatorConfigurationUIListSeparatorConfigurationitemSeparatorHandlerUICollectionLayoutListConfiguration.ItemSeparatorHandler
Configuring headers and footers
headerModefooterModeUICollectionLayoutListConfiguration.HeaderModeUICollectionLayoutListConfiguration.FooterModeheaderTopPadding
Customizing swipe actions
leadingSwipeActionsConfigurationProvidertrailingSwipeActionsConfigurationProviderUICollectionLayoutListConfiguration.SwipeActionsConfigurationProvider