UIListContentConfiguration
A content configuration for a list-based content view.
Declaration
struct UIListContentConfigurationOverview
A list content configuration describes the styling and content for an individual element that might appear in a list, like a cell, header, or footer. Using a list content configuration, you can obtain system default styling for a variety of different view states. You fill the configuration with your content, and then assign it directly to cells, headers, and footers in UICollectionView and UITableView, or to your own custom list content view (UIListContentView).
For views like cells, headers, and footers, use their defaultContentConfiguration() to get a list content configuration that has preconfigured default styling. Alternatively, you can create a list content configuration from one of the system default styles. After you get the configuration, you assign your content to it, customize any other properties, and assign it to your view as the current content configuration.
var content = cell.defaultContentConfiguration()
// Configure content.
content.image = UIImage(systemName: "star")
content.text = "Favorites"
// Customize appearance.
content.imageProperties.tintColor = .purple
cell.contentConfiguration = contentTopics
Creating default cell configurations
cell()subtitleCell()valueCell()sidebarCell()sidebarSubtitleCell()accompaniedSidebarCell()accompaniedSidebarSubtitleCell()
Creating header and footer configurations
plainHeader()plainFooter()groupedHeader()groupedFooter()prominentInsetGroupedHeader()extraProminentInsetGroupedHeader()sidebarHeader()
Customizing content
Customizing appearance
imagePropertiestextPropertiessecondaryTextPropertiesUIListContentConfiguration.ImagePropertiesUIListContentConfiguration.TextProperties
Customizing layout
axesPreservingSuperviewLayoutMarginsdirectionalLayoutMarginsprefersSideBySideTextAndSecondaryTextimageToTextPaddingtextToSecondaryTextHorizontalPaddingtextToSecondaryTextVerticalPadding