Instance Property インスタンスプロパティ

label

A view that describes the effect of switching the toggle between states.

Declaration 宣言

Discussion 議論

Use this value in your implementation of the makeBody(configuration:) method when defining a custom ToggleStyle. Access it through the that method’s configuration parameter.

Because the label is a View, you can incorporate it into the view hierarchy that you return from your style definition. For example, you can combine the label with a circle image in an HStack:


HStack {
    Image(systemName: configuration.isOn
        ? "checkmark.circle.fill"
        : "circle")
    configuration.label
}

See Also 参照

Getting the Label View