listRowSeparator

Sets the display mode for the separator associated with this specific row.

View ModifieriOS 15.0+macOS 13.0+listRowSeparator(_:edges:) in SwiftUI

Declaration

React
compose().listRowSeparator(
  visibility: SwiftUI.Visibility,
  options?: {
    edges?: SwiftUI.VerticalEdgeSet;
  }
)
Swift
nonisolated func listRowSeparator(
    _ visibility: Visibility,
    edges: VerticalEdge.Set = .all
) -> some View

Parameters

Discussion

Separators can be presented above and below a row. 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 of the separator visibility.

The following example shows a simple grouped list whose row separators are hidden:

List {
    ForEach(garage.cars) { car in
        Text(car.model)
            .listRowSeparator(.hidden)
    }
}
.listStyle(.grouped)

To change the color of a row separators, use View.listRowSeparatorTint(_:edges:). To hide or change the tint color for a section separators, use View.listSectionSeparator(_:edges:) and View.listSectionSeparatorTint(_:edges:).

See also

More in Lists and tables.