30.4 Using DisclosureGroup
The disclosure behavior outlined in the previous sections are implemented in the background using the DisclosureGroup view which is also available for use directly in SwiftUI-based apps to allow the user to hide and show non-structured items in a layout. The DisclosureGroup view is particularly useful when used in conjunction with the Form view.
Consider, for example, the following Form based layout:
Figure 30-5
The above screen shows part of the settings screen for an app, the SwiftUI declaration for which reads as follows:
Form {
Toggle("Allow Notificatons", isOn: $stateOne)
.padding(.leading)
Toggle("Audible Alerts", isOn: $stateTwo)
.padding(.leading)
Toggle("Color...