Initializer

init(_:)

Creates a group box based on a style configuration.

Declaration 宣言

init(_ configuration: GroupBoxStyleConfiguration)
Available when Label is GroupBoxStyleConfiguration.Label and Content is GroupBoxStyleConfiguration.Content.

Parameters パラメータ

configuration

The properties of the group box instance being created.

Discussion 議論

Use this initializer within the makeBody(configuration:) method of a GroupBoxStyle instance to create a styled group box, with customizations, while preserving its existing style.

The following example adds a pink border around the group box, without overriding its current style:


struct PinkBorderGroupBoxStyle: GroupBoxStyle {
    func makeBody(configuration: Configuration) -> some View {
        GroupBox(configuration)
            .border(Color.pink)
    }
}

See Also 参照

Creating a Group Box from a Configuration