Open DaisukeNagata opened 4 years ago
import SwiftUI
struct ToggleStates {
var oneIsOn: Bool = false
var twoIsOn: Bool = true
}
struct ContentView: View {
@State private var toggleStates = ToggleStates()
@State private var topExpanded: Bool = true
var body: some View {
DisclosureGroup("Items", isExpanded: $topExpanded) {
Toggle("Toggle 1", isOn: $toggleStates.oneIsOn)
Toggle("Toggle 2", isOn: $toggleStates.twoIsOn)
DisclosureGroup("Sub-items") {
Text("Sub-item 1")
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
https://developer.apple.com/documentation/swiftui/disclosuregroup