Skip to content

Instantly share code, notes, and snippets.

@Vzhukov74
Created June 7, 2022 10:57
Show Gist options
  • Save Vzhukov74/757a7dc0045176dec01561a366240205 to your computer and use it in GitHub Desktop.
Save Vzhukov74/757a7dc0045176dec01561a366240205 to your computer and use it in GitHub Desktop.
struct HalfTransparentBg: ViewModifier {
func body(content: Content) -> some View {
ZStack {
Color(white: 0, opacity: 0.5).ignoresSafeArea()
content
}
}
}
extension View {
func halfTransparentBg() -> some View {
modifier(HalfTransparentBg())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment