Declaration
compose().listSectionSeparatorTint(
color: SwiftUI.Color | null,
options?: {
edges?: SwiftUI.VerticalEdgeSet;
}
)nonisolated func listSectionSeparatorTint(
_ color: Color?,
edges: VerticalEdge.Set = .all
) -> some ViewParameters
color*SwiftUI.Color | nullThe color to use to tint the section separators, or
nilto use the default color for the current list style.options.edgesSwiftUI.VerticalEdgeSetThe set of row edges for which the tint applies. The list style might decide to not display certain separators, typically the top edge. The default is
VerticalEdge.Set.all.
Discussion
Separators can be presented above and below a section. You can specify to which edge this preference should apply.
This modifier expresses a preference to the containing List. The list
style is the final arbiter for the separator tint.
The following example shows a simple grouped list whose section separators are tinted based on section-specific data:
List {
ForEach(garage) { garage in
Section(header: Text(garage.location)) {
ForEach(garage.cars) { car in
Text(car.model)
.listRowSeparatorTint(car.brandColor)
}
}
.listSectionSeparatorTint(
garage.cars.last?.brandColor, edges: .bottom)
}
}
.listStyle(.grouped)To change the visibility and tint color for a row separator, use
View.listRowSeparator(_:edges:) and
View.listRowSeparatorTint(_:edges:).
To hide a section separator, use
View.listSectionSeparator(_:edges:).
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.
- listSectionIndexVisibilityChanges the visibility of the list section index.
- listSectionMarginsSet the section margins for the specific edges.
- listSectionSeparatorSets whether to hide the separator associated with a list 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.