Overview
This solution does not seem intuitive but this seems to be the easiest way to make your entire background view a single color.
struct Example: View {
var body: some View {
VStack {
Text("Hello")
}.background(Color.blue.edgesIgnoringSafeArea(.all))
}
}
Yes. From the Color
you can use edgesIgnoringSafeArea(.all)
and it should work.
I have seen many different examples of using ZStack
or nesting views within views, but this is fairly straightforward.
However I do forget that this solution exists so I have created a post to remind myself.
Here is a gist of sample to try out. Or you can click the copy button just above the code sample.