Created
February 19, 2022 20:39
-
-
Save aheze/7d432728473222ec468e96c20c6ea316 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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