title: Swift UI with Nested Navigation Views
body: <p>I am new to SwiftUI and Stack Overflow as well, so any help here is appreciated. I am currently making an app that has nested Navigation Views. However, one issue I am having is that when I am using these nested Views, the Navigation Titles (ex. the back button) are lining below each other, forming a Navigation Bar that is quite tall. I looked at <a href="https://stackoverflow.com/questions/57102209/how-can-i-avoid-nested-navigation-bars-in-swiftui">this</a> link and it used a List, but I do not want my app to be in this format. I would like to use text elements that are formatted in different colors and font sizes (please see the attached screenshot), however, this thread only has this list function, not in the format I would like it. Please help me figure out how to get rid of these extra navigation bars!</p>
  <p>Text Elements: <img src="https://i.stack.imgur.com/g5znt.png" alt="Text Elements Shown Here" /></p>
  <p>Nested Navigation Bar: <img src="https://i.stack.imgur.com/zPLeE.png" alt="Nested Navigation Bar Error Shown Here" /></p>
  <p>Here is my code:</p>
  <pre><code>import SwiftUI
  
  struct ContentView: View {
      var body: some View {
              
              NavigationView {
                  
                  ZStack {
                     
                      Image(&quot;img6&quot;).resizable().aspectRatio(contentMode: .fill).ignoresSafeArea()
                  VStack {
                      
                      Text(&quot;SLED&quot;).font(.largeTitle).fontWeight(.heavy).padding().background(Color.blue).cornerRadius(10.0)
                      Spacer()
                      Text(&quot;Shelf Life Expiry Date Tracker&quot;).font(.title).fontWeight(.bold)
                         
                          
                      Spacer()
                      
                      ZStack {
                      Image(systemName: &quot;cloud&quot;)
                          .padding()
                          .font(.system(size: 90))
                         
                      //try to fix this
                      //Image(&quot;logo1&quot;)
                          
                      Image(systemName: &quot;clock.fill&quot;)
                              .padding()
                          .font(.system(size: 40))
                      }
                      
                          
                                                                                               
                      
                                       NavigationLink(destination: SeeTestKit()) {
                                          Text(&quot;See Test Kit&quot;)
                                      }.foregroundColor(Color(red: 0.0, green: 0.0, blue: 0.0))
                                                 .padding(20)
                                                 .background(Color.pink)
                                                  .cornerRadius(10.0)
                                                     //Spacer()
                                                                          
                             HStack {
                                 Spacer()
                                 Image(systemName: &quot;bag&quot;)
                                         .padding()
                                     .font(.system(size: 40))
                                 Spacer()
                                 Image(systemName: &quot;alarm.fill&quot;)
                                         .padding()
                                     .font(.system(size: 40))
                                 Spacer()
                                 Image(systemName: &quot;calendar&quot;)
                                         .padding()
                                     .font(.system(size: 40))
                                 Spacer()
                              }
                  }
                  }                    
                  }
      }
             
   }
      
          
      
  
  
  struct ContentView_Previews: PreviewProvider {
      static var previews: some View {
          ContentView()
      }
  }```
  
  ```import SwiftUI
  
  struct SeeTestKit: View {
      var body: some View {
          
          
          
          NavigationView {
              ZStack {
                 
                  Image(&quot;background2&quot;)
                      .resizable()
                      .aspectRatio(contentMode: .fill)
                      .ignoresSafeArea()
          VStack {
              Spacer()
          Image(&quot;testkit&quot;)
              .resizable()
              .aspectRatio(contentMode: .fit)
              Spacer()
          
          Text(&quot;The test kit serves as a supplement to the SLED Tracking System.&quot;)
              .font(.title)
              .multilineTextAlignment(.center)
              Spacer()
              Text(&quot;The test kit make the observation process more efficient by not requiring you to find your own materials.&quot;)
                  .font(.title2)
                  .multilineTextAlignment(.center)
              Spacer()
              Text(&quot;It also serves as an alternative to \npeople who may not have access \nto the technology required for the app.&quot;).font(.title2).multilineTextAlignment(.center)
              Spacer()
          
              Group {
              NavigationLink(destination: TestKitMaterials()) {
                  Text(&quot;Materials&quot;)
                              }.foregroundColor(Color(red: 0.0, green: 0.0, blue: 0.0))
                      .padding(20)
                      .background(Color.blue)
                     .cornerRadius(10.0)
              .navigationBarTitle(&quot;Test Kit&quot;, displayMode: .inline).padding()
              
                  Spacer()
              }
          }
          }
          }
      }
  }
  
  struct SeeTestKit_Previews: PreviewProvider {
      static var previews: some View {
          SeeTestKit()
      }
  }```
  
  ```import SwiftUI
  
  struct TestKitMaterials: View {
      var body: some View {
          ZStack {
             
              Image(&quot;bckgrd&quot;)
                  .resizable()
                  .aspectRatio(contentMode: .fill)
                  .ignoresSafeArea()
              
          VStack {
              
              Text(&quot;Test Kit Materials&quot;)
                  .font(.title)
                  .fontWeight(.bold)
                  .foregroundColor(Color.white)
                  .padding(.all, 9.0)
                  .background(Color(red: 0.5, green: 0.6, blue: 0.9, opacity: 1.0)) .cornerRadius(10.0)
              
              //FIX this
              //Text(&quot;Safety Glasses&quot;).bold()
              Spacer()
              Group {
              Spacer()
              Text(&quot;Safety glasses were included to prevent \ncontamination or illness from \npotentially spoiled foods.&quot;)
                  .multilineTextAlignment(.center)
                  .padding(.all, 3.0)
                  
              Text(&quot;A thermometer was included to test \ntemperature of foods to test for spoilage \nat a certain temperature.&quot;)
                  .multilineTextAlignment(.center)
              .padding()
              }
              Group {
              Text(&quot;pH strips were used to test the pH of \nthe milk and eggs.&quot;)
                  .multilineTextAlignment(.center)
              .padding()
              Text(&quot;The flashlight and ruler are included for \nthe user to measure the width of the air\n sac of the egg in a dark room.&quot;)
                  .multilineTextAlignment(.center)
              .padding()
              }
              Group {
              Text(&quot;A pipette is needed to extract samples \nof the food to test certain characteristics.&quot;)
                  .multilineTextAlignment(.center)
              .padding()
              Text(&quot;The test tube provides a separate vessel \nto hold the milk to make observations.&quot;)
                  .multilineTextAlignment(.center)
              .padding()
              Text(&quot;A checklist is included as a guideline for the \nuser to measure characteristics and to\n measure spoilage in the absence of the app.&quot;)
                  .multilineTextAlignment(.center)
              .padding()
              }
              
              Spacer()
              
              Image(systemName: &quot;img&quot;)
                  .resizable()
                  .aspectRatio(contentMode: .fit)
  
              
          }
          }
      }
  }
  
  struct TestKitMaterials_Previews: PreviewProvider {
      static var previews: some View {
          TestKitMaterials()
      }
  }```
  </code></pre>
  <p>Thank you!</p>