title: How to set a navigation bar in clear / transparent background in SwiftUI?
body: <p>I am trying to figure out how to write a code for a custom navigation bar to display clear / transparent bar not &quot;white&quot; bar. See this screenshot:</p>
  <img src="https://i.stack.imgur.com/j4Pzn.png" width="320">
  <p>Here is my code:</p>
  <pre><code>import SwiftUI
  
  struct ContentView: View {
  
  init() {
  
      UINavigationBar.appearance().tintColor = .clear
      UINavigationBar.appearance().backgroundColor = .clear
  }
  
  var body: some View {
  
      NavigationView {
           ZStack {
                Color(.lightGray).edgesIgnoringSafeArea(.all)
                  VStack() {
                      Spacer()
                      Text(&quot;Hello&quot;).foregroundColor(.white)
                      Spacer()
                  }
              }
              .navigationBarTitle(Text(&quot;First View&quot;), displayMode: .inline)
          }
      }
  }
  
  struct ContentView_Previews: PreviewProvider {
      static var previews: some View {
         ContentView()
      
   }
  }
  </code></pre>
  <p>Does anybody know what is wrong with it?</p>