title: How to add button on navigation bar with SwiftUI
body: <p>I have two structs <code>ContentView.swift</code> </p>
  
  <pre><code>struct ContentView: View {
      var body: some View {
          NavigationView{
              ZStack {
                  Color(red: 0.09, green: 0.63, blue: 0.52)
                      .edgesIgnoringSafeArea(.all)
  
                  VStack {
                      Image("flower_logo")
                          .resizable()
                          .aspectRatio(contentMode: .fit)
                          .frame(width: 150.0, height: 150.0)
                          .clipShape(Circle())
  
                      Text("ScanFlower")
                          .font(Font.custom("Pacifico-Regular", size: 40))
                          .bold()
                          .foregroundColor(.white)
  
                      Text("DETECT FLOWER SPECIES")
                          .foregroundColor(.white)
                          .font(.system(size: 15))
  
                      Spacer()
                          .frame(height: 100)
  
                      NavigationLink(destination: ScanWithCamera()){
                          NavigateButtons(imageName: "camera.fill", text: "Scan with camera")
                      }
  
                      NavigateButtons(imageName: "photo.fill", text: "Use pictures")
                      NavigateButtons(imageName: "chart.bar.fill", text: "Check your database")
                  }
              }
          }
  
      }
  }
  
  struct ContentView_Previews: PreviewProvider {
      static var previews: some View {
          ContentView()
      }
  }
  </code></pre>
  
  <p>which moved to second view <code>ScanWithCamera.swift</code> by click on NavigationLink "Scan with Camera". In <code>ScanWithCamera.swift</code></p>
  
  <pre><code>struct ScanWithCamera: View {
      var body: some View {
          NavigationView{
              Text("Damn...bro...")
                  .navigationBarTitle("Page2",displayMode: .inline)
              .navigationBarItems(leading:
                  Button(action: {
                      print("Edit button pressed...")
                  }) {
                      Text("Edit")
                  }
              )
          }
  
      }
  }
  
  struct ScanWithCamera_Previews: PreviewProvider {
      static var previews: some View {
          ScanWithCamera()
      }
  }
  
  struct ScanWithCamera_Previews: PreviewProvider {
      static var previews: some View {
          ScanWithCamera()
      }
  }
  </code></pre>
  
  <p>I would like to have a button on Navigation Bar, but I have no idea how to add it there. When I tried to do it with <code>.navigationBarItems</code>, I had navigation bar for almost half of screen<a href="https://i.stack.imgur.com/w4weQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/w4weQ.png" alt="enter image description here"></a> like on the screen. how to add this button there so that the navigation bar does not increase?</p>