Last active
January 8, 2021 08:57
-
-
Save dchakarov/d841e709ccb0bcc961302b2a248912ec 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
import SwiftUI | |
struct BackgroundModifier: ViewModifier { | |
let colour: Color | |
func body(content: Content) -> some View { | |
ZStack { | |
colour | |
.edgesIgnoringSafeArea(.all) | |
content | |
} | |
} | |
} | |
extension View { | |
func applyBackground(colour: Color? = nil) -> some View { | |
modifier(BackgroundModifier(colour: colour ?? Colours.mainBackground)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Such a great idea, thanks for showing this! 👍