Separator

Represents a Material UI styled separator for dividing sections within a view.

Overview

The Separator view creates a styled divider that can be used to visually separate sections in your layout. By default, it displays a horizontal separator, but it can also be configured to display a vertical separator.

To you use Separator, initialize it with or without specifying its orientation.

Initializer

Creates a separator with default horizontal orientation.

Separator()

Creates a separator with the custom orientation.

Separator(orientation: SeparatorOrientationStyle)

For detailed descriptions of the available orientation styles, refer to the SeparatorOrientationStyle.

Parameter

Parameter
Description

orientation

The orientation of the separator.

Example

Displays a default horizontal oriented separator.

Container {
    Text("Section 1")
    Separator()
    Text("Section 2")
}

Displays a custom oriented separator.

HStack {
    Text("Section 1")
    Separator(orientation: .vertical)
    Text("Section 2")
}

Last updated