Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
struct AquaButtonStyle: ButtonStyle {
func makeBody(configuration: Self.Configuration) -> some View {
struct AquaButton: View {
var body: some View {
GeometryReader { geometry in
let topHighlightHeight = geometry.size.height * 0.3
let bottomHighlightOffset = geometry.size.height * 0.6
ZStack {
Capsule() //Behind highlight
.offset(y: 1.5)
Group {
//Main colour (foregroundColor of the Button)
//Gradient on top of the main colour
Capsule() //Bottom highlight
.offset(y: bottomHighlightOffset)
.blur(radius: 3)
Group {
Capsule() //Top highlight
.frame(height: topHighlightHeight)
.offset(y: 1)
.blur(radius: 2)
.padding(.horizontal, 5)
.frame(maxHeight: .infinity, alignment: .top)
//The outline for the button
Capsule().stroke(, lineWidth: 3.5)
//Make sure none of the layers go outside the shape
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment