I am new to SwiftUI (like most people) and trying to figure out how to remove some whitespace above a List that I embedded in a NavigationView
In this image, you can
Similar to the answer by @graycampbell but a little simpler:
struct YourView: View {
@State private var isNavigationBarHidden = true
var body: some View {
NavigationView {
VStack {
Text("This is the master view")
NavigationLink("Details", destination: Text("These are the details"))
}
.navigationBarHidden(isNavigationBarHidden)
.navigationBarTitle("Master")
.onAppear {
self.isNavigationBarHidden = true
}
.onDisappear {
self.isNavigationBarHidden = false
}
}
}
}
Setting the title is necessary since it is shown next to the back button in the views you navigate to.