Created
September 19, 2021 14:18
-
-
Save SarahAlsharif/ec18388f15a06cefc566136a3970a87e 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
struct ConcaveGlassView: ViewModifier { | |
func body(content: Content) -> some View { | |
if #available(iOS 15.0, *) { | |
content | |
.padding() | |
.frame(height: 50) | |
.background(.ultraThinMaterial) | |
.overlay( | |
RoundedRectangle(cornerRadius: 14) | |
.stroke(.linearGradient(colors:[.black,.white.opacity(0.75)], startPoint: .top, endPoint: .bottom), lineWidth: 2) | |
.blur(radius: 2) | |
) | |
.overlay( | |
RoundedRectangle(cornerRadius: 14) | |
.stroke(.radialGradient(Gradient(colors: [.clear,.black.opacity(0.1)]), center: .bottomLeading, startRadius: 300, endRadius: 0), lineWidth: 15) | |
.offset(y: 5) | |
) | |
.cornerRadius(14) | |
} else { | |
// Fallback on earlier versions | |
content | |
.padding() | |
.frame(height: 50) | |
.cornerRadius(14) | |
.shadow(color: .white, radius: 3, x: -3, y: -3) | |
.shadow(color: .black, radius: 3, x: 3, y: 3) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment