Declaration
compose().listSectionIndexVisibility(
visibility: SwiftUI.Visibility
)nonisolated func listSectionIndexVisibility(
_ visibility: Visibility
) -> some ViewParameters
visibility*SwiftUI.VisibilityThe visibility of the list section index.
Discussion
The section index shows the section index labels of sections, which are
set using the sectionIndexLabel modifier. These are typically the
letters of the alphabet, used for sorted sections.
List(sections) { section in
Section(section.title) {
ForEach(section.rows) { row in
// ...
}
}
.sectionIndexLabel(section.indexTitle)
}
.listSectionIndexVisibility(.visible)On iOS, the section index is displayed as a number of vertically stacked letters on the trailing side of the list. Users can jump to a specific section in the list by tapping on the corresponding index label.
On watchOS, the index of the section currently visible is displayed next to the scroll indicator when the user is scrolling through the list using the crown.
By default, the list section index is visible if the list contains any sections with an index label.
The index only shows labels for sections with a sectionIndexLabel
modifier. This can be used to hide certain sections from the index.
By hiding section headers of empty sections with an index label, a list section index can be made to show index labels without a corresponding section.
See also
More in Lists and tables.
- deleteDisabledAdds a condition for whether the view's view hierarchy is deletable.
- listItemTintSets the tint effect for content in a list.
- listRowBackgroundPlaces a custom background view behind a list row item.
- listRowInsetsSets the insets of rows in a list on the specified edges.
- listRowSeparatorSets the display mode for the separator associated with this specific row.
- listRowSeparatorTintSets the tint color associated with a row.
- listRowSpacingSets the vertical spacing between two adjacent rows in a List.
- listSectionMarginsSet the section margins for the specific edges.
- listSectionSeparatorSets whether to hide the separator associated with a list section.
- listSectionSeparatorTintSets the tint color associated with a section.
- listSectionSpacingSets the spacing between adjacent sections in a List to a custom value.
- moveDisabledAdds a condition for whether the view's view hierarchy is movable.