Skip to content

Instantly share code, notes, and snippets.

@dchakarov
Last active January 8, 2021 08:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dchakarov/d841e709ccb0bcc961302b2a248912ec to your computer and use it in GitHub Desktop.
Save dchakarov/d841e709ccb0bcc961302b2a248912ec to your computer and use it in GitHub Desktop.
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))
}
}
@fassko
Copy link

fassko commented Jan 8, 2021

Such a great idea, thanks for showing this! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment