Skip to content

Instantly share code, notes, and snippets.

@aheze
Created February 19, 2022 21:47
Show Gist options
  • Save aheze/503191612b30d99bcd550128c13db473 to your computer and use it in GitHub Desktop.
Save aheze/503191612b30d99bcd550128c13db473 to your computer and use it in GitHub Desktop.
struct ContentView: View {
@State var present = false
var body: some View {
Button("Present popover!") {
present = true
}
.frameTag("Button")
.popover(present: $present) {
Text("Hi, I'm a popover.")
.padding()
.foregroundColor(.white)
.background(.blue)
.cornerRadius(16)
} background: {
PopoverReader { context in
Templates.CurveConnector(
start: context.frame.point(at: .top),
end: context.window.frameTagged("Button").point(at: .bottom)
)
.stroke(Color.blue, lineWidth: 4)
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment