label
A view that describes the effect of switching the toggle between states.
Declaration
let label: ToggleStyleConfiguration.LabelDiscussion
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
}