I want to set the background color for the entire app using SwiftUI.
What is the idiomatic way to do this?
I know there is an option to set a background color using a ZStack
approach:
import SwiftUI
struct ContentView: View {
var body: some View {
ZStack { // 1
Color.powder950.ignoresSafeArea() // 2
Text("Hello, world!")
}
}
}
#Preview {
ContentView()
}
But it seems repetitive to set a ZStack
with a background color on each newly created screen.
Is there a way to set a background color for the entire app globally?
3