So I've been playing around with SwiftUI and I can't seem to stack NavigationView
correctly with ScrollView
and ZStack
.
I'm trying to achieve a view with a .black
background. Code below:
MainView.swift
var body: some View {
NavigationView {
ChildView()
}
}
ChildView.swift
var body: some View {
ZStack {
Color.black.edgesIgnoringSafeArea(.all)
ScrollView {
...
}
}
}
The above code gives me a black background but breaks the navigation bar behaviour.
So it seems like the the navigation doesn't go from the scrollEdgeAppearance
to standardAppearance
when scrolling.
Any ideas?