First look at this result:

As you can see, you can set the color of each element in the View hierarchy like this:
struct ContentView: View {
init(){
UINavigationBar.appearance().backgroundColor = .green
//For other NavigationBar changes, look here:(https://stackoverflow.com/a/57509555/5623035)
}
var body: some View {
ZStack {
Color.yellow
NavigationView {
ZStack {
Color.blue
Text("Some text")
}
}.background(Color.red)
}
// iOS 16 - No need for tweaking the appearance
/* .toolbarBackground(.green, in: .navigationBar) */
}
}
And the first one is window
:
window.backgroundColor = .magenta
The issue you faced is we can not remove the background color of SwiftUI's HostingViewController
(yet), so you can't see the navigationView
(What you called) through the views hierarchy. You should wait for the API or try to fake the navigation view (not recommended).