Lists
Display a structured, scrollable column of information.
Overview
Use a list to display a one-dimensional vertical collection of views.
[Image]
The list is a complex container type that automatically provides scrolling when it grows too large for the current display. You build a list by providing it with individual views for the rows in the list, or by using a ForEach to enumerate a group of rows. You can also mix these strategies, blending any number of individual views and ForEach constructs.
Use view modifiers to configure the appearance and behavior of a list and its rows, headers, sections, and separators. For example, you can apply a style to the list, add swipe gestures to individual rows, or make the list refreshable with a pull-down gesture. You can also use the configuration associated with Scroll views to control the list’s implicit scrolling behavior.
For design guidance, see Lists and tables in the Human Interface Guidelines.
Topics
Creating a list
Disclosing information progressively
Configuring a list’s layout
listRowInsets(_:)defaultMinListRowHeightdefaultMinListHeaderHeightlistRowSpacing(_:)listSectionSpacing(_:)ListSectionSpacinglistSectionMargins(_:_:)
Configuring rows
Configuring headers
Configuring separators
listRowSeparatorTint(_:edges:)listSectionSeparatorTint(_:edges:)listRowSeparator(_:edges:)listSectionSeparator(_:edges:)
Configuring backgrounds
listRowBackground(_:)alternatingRowBackgrounds(_:)AlternatingRowBackgroundBehaviorbackgroundProminenceBackgroundProminence
Displaying a badge on a list item
Configuring interaction
swipeActions(edge:allowsFullSwipe:content:)selectionDisabled(_:)listRowHoverEffect(_:)listRowHoverEffectDisabled(_:)
Refreshing a list’s content
Editing a list
moveDisabled(_:)deleteDisabled(_:)editModeEditModeEditActionsEditableCollectionContentIndexedIdentifierCollection