Structure

GroupBox

A stylized view, with an optional label, that visually collects a logical grouping of content.

Declaration 宣言

struct GroupBox<Label, Content> where Label : View, Content : View

Overview 概要

Use a group box when you want to visually distinguish a portion of your user interface with an optional title for the boxed content.

The following example sets up a GroupBox with the label “End-User Agreement”, and a long agreementText string in a Text view wrapped by a ScrollView. The box also contains a Toggle for the user to interact with after reading the text.


var body: some View {
    GroupBox(label:
        Label("End-User Agreement", systemImage: "building.columns")
    ) {
        ScrollView(.vertical, showsIndicators: true) {
            Text(agreementText)
                .font(.footnote)
        }
        .frame(height: 100)
        Toggle(isOn: $userAgreed) {
            Text("I agree to the above terms")
        }
    }
}

An iOS status bar above a gray rounded rectangle region marking the bounds

Topics 話題

Creating a Group Box グループボックスを作成する

Creating a Group Box from a Configuration

Styling Group Boxes

Supporting Types 支援を行う型

Deprecated Initializers

Default Implementations 省略時実装

Relationships 関係

Conforms To 次に準拠

See Also 参照

Groups