Created
March 2, 2021 15:05
-
-
Save alenm/25e9d6b5d37615412466ea687ad4093b to your computer and use it in GitHub Desktop.
Setting background color when top edge is white
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
/* | |
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