Skip to content

Instantly share code, notes, and snippets.

@alenm
Created March 2, 2021 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alenm/25e9d6b5d37615412466ea687ad4093b to your computer and use it in GitHub Desktop.
Save alenm/25e9d6b5d37615412466ea687ad4093b to your computer and use it in GitHub Desktop.
Setting background color when top edge is white
/*
Scenario: Sometimes you want the entire background color to be filled in your SwiftUI
- One solution is to make the color `edgesIgnoringSafeArea(.all)`
- This is not obvious but it seems to work for now
*/
struct Example: View {
var body: some View {
VStack {
Text("Hello")
}.background(Color.blue.edgesIgnoringSafeArea(.all))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment