Last active
September 21, 2021 21:36
-
-
Save SarahAlsharif/8f9d43c0f9c7ae01c31f504673bd20dd 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 ConcaveGlassViewWithOverlay: ViewModifier { | |
func body(content: Content) -> some View { | |
if #available(iOS 15.0, *) { | |
content | |
.padding() | |
.frame(height: 50) | |
.background(.ultraThinMaterial) | |
.overlay( | |
LinearGradient(colors: [.black.opacity(0.2), .clear], startPoint: .top, endPoint: .bottom)) | |
.cornerRadius(14) | |
.shadow(color: .white.opacity(0.9), radius: 2, x: -1, y: -2) | |
.shadow(color: .black.opacity(0.6), radius: 2, x: 2, y: 2) | |
} 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