Skip to content

Instantly share code, notes, and snippets.

@mattyoung
Created July 2, 2021 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattyoung/c8ecad1d5b572a6d22e2a4f497dee674 to your computer and use it in GitHub Desktop.
Save mattyoung/c8ecad1d5b572a6d22e2a4f497dee674 to your computer and use it in GitHub Desktop.
import SwiftUI
struct ContentView: View {
@State private var show = false
var body: some View {
// DisclosureGroup doesn't work here, works in `List`
VStack {
#warning("doesn't show content on expand at all")
DisclosureGroup {
Text("Content")
} label: {
Text("Label")
}
#warning("only show content in Xcode preview, doesn't show in sim or device")
DisclosureGroup(isExpanded: $show) {
Text("Content")
} label: {
Text("Label")
}
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment