title: Switch between views in SwiftUI
body: <p>Basically, I am trying to go from a loading page with only a logo and a progress view bar to a completely new screen called HomeView. Whenever the progress bar is done loading, I want to go straight to HomeView and I will never go back to the loading page again. Is there a way to switch between screens like this?</p>
  <p>I saw many people on youtube use navigation links, but I don't have a button or anything to trigger it. Also, I saw that when they go to the new page, they can still click on the blue back button to go back to the loading page, which is what I don't want to happen.</p>
  <p>I leave the code below in case y'all need a reference.</p>
  <p>I am new to ios programming so thank y'all for helping.</p>
  <p>This is the loading page</p>
  <pre><code>import SwiftUI
  
  struct ContentView: View {
      
      @State var downloadAmount: Float = 0.0
      let timer = Timer.publish(every: 0.1, on: .main, in: .common).autoconnect()
      
      var body: some View {
          ZStack {
              Color (red: 12/255, green: 18/255, blue: 25/255).edgesIgnoringSafeArea(.all)
              VStack(spacing: 30.0) {
                  Image(&quot;logo&quot;)
                  ProgressView(value: downloadAmount, total: 50).accentColor(Color(red: 255/255, green: 232/255, blue: 147/255))            }.padding(.horizontal, 50)
              .onReceive(timer) { _ in
                  if downloadAmount &lt; 50 {
                      downloadAmount += 2
                  }
              }
          }
      }
  }
  
  struct ContentView_Previews: PreviewProvider {
      static var previews: some View {
          ContentView()
              
      }
  }
  </code></pre>
  <p>And I want to go straight to HomeView after the progress bar runs out.</p>
  <pre><code>import SwiftUI
  
  struct HomeView: View {
      
      @State var progressValue: Float = 0.2
      
      var body: some View {
          Text(&quot;Hello World&quot;)
      }
  }
  
  struct HomeView_Preview: PreviewProvider {
      static var previews: some View {
          ContentView()
              
      }
  }
  
  
  </code></pre>