隐藏的导航栏仍然下推视图

Hidden Navbar still pushes down view

我有一个:

contentView()
SignUpView()
SignInView()

contentView 调用 SignInView()

struct ContentView: View {

    var body: some View {
        NavigationView {
            SignInView()
        }
    }
}

在我的 SignUpView() 中我有:

var body: some View {
    VStack(alignment: .leading) {
       NavigationLink(destination: SignInView()) {
          Text("Sign in")
            .fontWeight(.semibold)
            .foregroundColor(Color("startColor"))
        }
   }.navigationBarHidden(true)

在我的 SigbInView 中我有:

var body: some View {
  VStack(alignment: .leading) {
    NavigationLink(destination: SignUpView()) {
       Text("Sign up")
       .fontWeight(.semibold)
       .foregroundColor(Color("startColor"))
     }.navigationBarHidden(true)

我使用 .navigationBarHidden(true) 来隐藏栏,但 < back 仍然出现在左上角以带您返回上一个屏幕,我还尝试添加导航栏 text = "" 并将 属性 设置为 .inline

我试图仅在 SignInView 和 SignUpView 上使用这些导航链接进行导航,我不希望显示该栏或将视图下推。

所以看起来另一个 属性 可以设置为 true 来隐藏后退按钮:

.navigationBarBackButtonHidden(true)

这对我有用。