Skip to content

UICollectionLayoutListConfiguration ​

UICollectionLayoutListConfiguration represents the configuration of a list layout: the list's appearance, whether separators are drawn between rows, the background color, and where section headers come from.

It is just data. The moment it is handed to UICollectionViewCompositionalLayout.layoutWithListConfiguration(), the configuration is copied into the layout. Changing it afterward does not change lists already created.

Inheritance: EventTarget → NSObject → UICollectionLayoutListConfiguration

Constructor ​

UICollectionLayoutListConfiguration()

Creates a configuration with an appearance.

Instance properties ​

PropertyDescription
appearance read-onlyThe appearance given at creation
showsSeparatorsWhether separators are drawn between rows
backgroundColorThe list's background color
headerModeWhere section headers come from

Examples ​

js
const config = new UICollectionLayoutListConfiguration('plain');
config.showsSeparators = false;
const list = new UICollectionView(
  UICollectionViewCompositionalLayout.layoutWithListConfiguration(config));

Effect: A list whose rows span the full width, with no separators. How it looks on screen is not verified in the simulator.

Note: The configuration is copied into the layout at the moment of layoutWithListConfiguration(). Changing config afterward does not change lists already created.

Corresponding iOS API ​

ObjCJS
[[UICollectionLayoutListConfiguration alloc] initWithAppearance:UICollectionLayoutListAppearanceInsetGrouped]new UICollectionLayoutListConfiguration('insetGrouped')
config.showsSeparators = NOconfig.showsSeparators = false
config.headerMode = UICollectionLayoutListHeaderModeFirstItemInSectionconfig.headerMode = 'firstItemInSection'

See also ​