title: Large space above navigationTitle (Swift / SwiftUI)
body: <p>My view has this massive space above the title text and I was am not sure how to get rid of it as everything I've tried seems to do nothing. How can I remove this space? Initially, I intended to just hide the navigation bar, however, I want to the back button for demonstrative purposes.</p>
  <p>Apologies for all the commented-out code.</p>
  <p>How the view looks (the blue is just for visualization purposes):</p>
  <p><a href="https://i.stack.imgur.com/04oRl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/04oRl.png" alt="enter image description here" /></a></p>
  <p>Code for the above View:</p>
  <pre><code>struct LoggedinView: View {
      @Binding var userName:String
      @Binding var userModelData : UserModelData
      
      var userInformation : UserModel?
      
      var body: some View{
          NavigationView{
              VStack{
                  if let items = userInformation{
                      /*Text(&quot;\(items.username)'s \(items.type)&quot;)
                          .font(.title)
                          .fontWeight(.bold/)*/
                      
        
                      List(items.items, id: \.self){ item in
                                  Text(item)
                      }
                      .navigationTitle(&quot;\(items.username)'s \(items.type)&quot;)
                      //.navigationBarHidden(true)
                  }
  
              }
              //.navigationTitle(&quot;Hi&quot;)
              //.navigationBarHidden(true)
              //.navigationBarTitleDisplayMode(.inline)
            
          }.onAppear {
              UINavigationBar.appearance().backgroundColor = .blue
          }
          //.navigationBarHidden(true)
          //.navigationTitle(&quot;&quot;)
       
      }
  }
  </code></pre>
  <p>Code that displays the view shown:</p>
  <pre><code>struct ContentView: View {
      @State public var userName: String = &quot;&quot;
      @State public var userPassword: String = &quot;&quot;
      @State private var errorMsg: String = &quot;&quot;
      
      @State private var showPassword: Bool = false
      @State private var authenticationPassed:Bool = false
      
      @State var userModelData = UserModelData()
  
      var userInformation : UserModel? {
              userModelData.userInformation.first { $0.username == userName }
          }
      
      @State var errorMsgColor = Color(red:220.0/255.0, green:0.0, blue:0.0)
  
      var body: some View {
   
      NavigationView{
          VStack{
              Group{ //titles
                  Text(&quot;Welcome Back!&quot;)
                      .fontWeight(.bold)
                      .font(.largeTitle)
                  
                  UserImage()
                  
                  Spacer()
                      .frame(height: 25)
              }
              
              Group{ //inputs
                  TextField(&quot;Username&quot;, text: $userName )
                      .padding()
                      .overlay(RoundedRectangle(cornerRadius: 30.0)
                                          .stroke(Color.black, lineWidth: 3))
                      .disableAutocorrection(true)
                      .autocapitalization(.none)
                  
                  Spacer()
                      .frame(height: 20)
                  
                  if showPassword{
  
                      TextField(&quot;Password&quot;, text: $userPassword)
                          .padding()
                          .overlay(RoundedRectangle(cornerRadius: 30.0)
                                      .stroke(Color.black, lineWidth: 3))
                          .disableAutocorrection(true)
                          .autocapitalization(.none)
                  }else{
                     
                      SecureField(&quot;Password&quot;, text: $userPassword)
                          .padding()
                          .overlay(RoundedRectangle(cornerRadius: 30.0)
                                  .stroke(Color.black, lineWidth: 3))
                          .disableAutocorrection(true)
                          .autocapitalization(.none)
          
                  }
                  
                  ShowPasswordButton(showPassword: $showPassword)
              }
              
              Group{ //error msg + button
                  Button(action:{
                      
                      if self.userName == userInformation?.username &amp;&amp; self.userPassword == userInformation?.password {
                          self.authenticationPassed = true
                      }else{
                          self.authenticationPassed = false
                      }
                      
                      if !authenticationPassed {
                          errorMsg = &quot;Incorrect username or password, please try again&quot;
                          errorMsgColor = Color(red:220.0/255.0, green:0.0, blue:0.0)
                      }else{
                          errorMsg = &quot;Success&quot;
                          errorMsgColor = Color(red:0.0, green:200.0/255.0, blue:0.0)
                      }
                  
                  }){
                      CustomButtonStyle(buttonText: &quot;Login&quot;)
                  }
                  
                  Spacer()
                      .frame(height: 25)
                  
                  Text(errorMsg)
                      .foregroundColor(errorMsgColor)
                  
                  NavigationLink(destination: LoggedinView(userName: $userName, userModelData: $userModelData, userInformation: userInformation), isActive: $authenticationPassed){
                      EmptyView()
                 }
                  //.navigationTitle(&quot;&quot;)
                  .navigationBarHidden(true)
              }
              
          }
          .padding()
          //.navigationTitle(&quot;&quot;)
          .navigationBarHidden(true)
      }
          
      }
  }
  </code></pre>