Skip to content

Instantly share code, notes, and snippets.

@aheze
Created February 19, 2022 21:23
Show Gist options
  • Save aheze/1e492dca4401f660b5cf673188c0d632 to your computer and use it in GitHub Desktop.
Save aheze/1e492dca4401f660b5cf673188c0d632 to your computer and use it in GitHub Desktop.
struct ContentView: View {
@State var selection: String?
var body: some View {
HStack {
Button("1st") { selection = "1" }
.popover(selection: $selection, tag: "1") {
Text("1st Popover")
.padding()
.foregroundColor(.white)
.background(.red)
}
Button("2nd") { selection = "2" }
.popover(selection: $selection, tag: "2") {
Text("2nd Popover")
.padding()
.foregroundColor(.white)
.background(.green)
}
Button("3rd") { selection = "3" }
.popover(selection: $selection, tag: "3") {
Text("3rd Popover")
.padding()
.foregroundColor(.white)
.background(.blue)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment