I am trying to create a navigation view in SwiftUI - I want to navigate from the login form to the Home Screen. In the preview, the Home Screen is looking how it should, but on the live preview - it is centered in the middle of the screen. I tried with .navigationBarHidden(true), it goes a little bit up, but still not on the top of the screen. Please help.
struct ContentView: View {
@EnvironmentObject var viewModel: AppViewModel
var body: some View {
NavigationView {
if viewModel.signedIn {
NavigationView {
HomeScreen()
}
.navigationBarHidden(true)
}
else {
SignInView()
}
}
.onAppear {
viewModel.signedIn = viewModel.isSignedIn
}
}
}