Last active
December 15, 2022 17:13
-
-
Save thepearl/95695c8e2f2f850c459570d58683deac to your computer and use it in GitHub Desktop.
This file contains 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 ShadowBorderModifier: ViewModifier { | |
func body(content: Content) -> some View { | |
content | |
.border(Color.black, width: 1) | |
.shadow(radius: 5) | |
} | |
} | |
extension View { | |
func dropShadow() -> some View { | |
ModifiedContent(content: self, modifier: ShadowBorderModifier()) | |
} | |
} | |
// Call the modifier on any View | |
Text("Hello, world!") | |
.dropShadow() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment