Skip to content

Instantly share code, notes, and snippets.

@aheze
Created February 19, 2022 20:39
Show Gist options
  • Save aheze/7d432728473222ec468e96c20c6ea316 to your computer and use it in GitHub Desktop.
Save aheze/7d432728473222ec468e96c20c6ea316 to your computer and use it in GitHub Desktop.
Button("Present popover!") {
present = true
}
.popover(
present: $present,
attributes: {
$0.presentation.animation = .spring(response: 0.6, dampingFraction: 0.4, blendDuration: 1)
$0.presentation.transition = .offset(x: 0, y: 30).combined(with: .opacity)
$0.dismissal.transition = .offset(x: 0, y: 30).combined(with: .opacity)
$0.rubberBandingMode = .yAxis
}
) {
Text("Hi, I'm a bouncy popover!")
.padding()
.foregroundColor(.white)
.background(
LinearGradient(colors: [.blue, .green], startPoint: .top, endPoint: .bottom),
in: RoundedRectangle(cornerRadius: 16)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment