Skip to content

Instantly share code, notes, and snippets.

@peantunes
Last active January 10, 2024 04:57
Show Gist options
  • Save peantunes/6c4a4b68986634ba2192e6142848bc77 to your computer and use it in GitHub Desktop.
Save peantunes/6c4a4b68986634ba2192e6142848bc77 to your computer and use it in GitHub Desktop.
Glow in the dark View Modifier for SwiftUI
struct GlowInTheDarkViewModifier: ViewModifier {
let active: Bool
@ViewBuilder func body(content: Content) -> some View {
if active {
content
.shadow(color: .yellow, radius: 5)
.shadow(color: .white, radius: 5)
.shadow(color: .green, radius: 5)
.shadow(color: .blue, radius: 5)
.shadow(color: .green, radius: 5)
.shadow(color: .blue, radius: 5)
} else {
content
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment