title: NavigationLink issue: Cannot convert value of type '...' to expected argument type '...'
body: <p>I am trying to create a navigation screen that will give two buttons - one that goes to a fun little game and one that goes to a part that shows me random images. I've found the NavigationLink function and I can get it to work generally, but I'm getting an error that I don't understand. I've looked up a number of solutions, but none that use NavigationLink, so I'm not sure how to implement what I've read.</p>
  <p>One of the buttons should navigate to the game, but the NavigationLink is giving the error: &quot;Cannot convert value of type 'GameViewModel.Type' to expected argument type 'GameViewModel'&quot;</p>
  <p>If I try and remove &quot;viewModel: GameViewModel&quot; and instead replace it with a normal &quot;choice: String&quot;, it instead gives the error: &quot;Missing argument for parameter 'viewModel' in call&quot; and then suggests a fix that just puts &quot;viewModel: GameViewModel&quot; right back as it is below.</p>
  <p>What I don't understand is what this is trying to tell me. All I'm trying to do is have the NavigationView go to start the game, which is from the &quot;struct GameView: View {&quot; line at top. It seems like there is some sort of issue with the &quot;var viewModel: GameViewModel&quot;, but I've tried putting that in other places and just can't get it to work.</p>
  <p>If I remove the NavigationLink parts and just have it start the game, it works. If I remove the NavigationLink parts and just have it show me the pictures, it works. It's just this error that I don't understand.</p>
  <p>I'd appreciate any help! This forum has really helped me over the past week or so, which has been so great!</p>
  <p>Updated code:</p>
  <pre><code>import SwiftUI
  import Foundation
  
  struct ContentView: View {
      @State private var score = 0
      var body: some View {
          NavigationView {
              Image(&quot;Clouds&quot;)
                  .overlay(
                  VStack {
                      NavigationLink(destination: ResultView2(choice: &quot;Menu2&quot;)) {
                              Image(&quot;Menu2&quot;)
                      }
                      NavigationLink(destination: GameView(viewModel: GameViewModel(Engine.self as! Engine, storage: Storage.self as! Storage, stateTracker: StateTracker.self as! StateTracker))) {
                              Image(&quot;Menu&quot;)
                      }
                  })
          }
      }
  
  struct ContentView_Previews: PreviewProvider {
      static var previews: some View {
          ContentView()
      }
  }
  }
  
  struct GameView: View {
      @ObservedObject var viewModel: GameViewModel
      @State var showMenu = false
      var body: some View {
          VStack(alignment: .center, spacing: 16) {
              Header(score: viewModel.state.score, bestScore: viewModel.bestScore, menuAction: {
                  self.showMenu.toggle()
              }, undoAction: {
                  self.viewModel.undo()
              }, undoEnabled: self.viewModel.isUndoable)
              GoalText()
              Board(board: viewModel.state.board, addedTile: viewModel.addedTile)
              Moves(viewModel.numberOfMoves)
          }
          .frame(minWidth: .zero,
                 maxWidth: .infinity,
                 minHeight: .zero,
                 maxHeight: .infinity,
                 alignment: .center)
              .background(Color.gameBackground)
              .background(Menu())
              .background(GameOver())
              .edgesIgnoringSafeArea(.all)
      }
  }
  extension GameView {
  private func Menu() -&gt; some View {
      EmptyView().sheet(isPresented: $showMenu) {
          MenuView(newGameAction: {
              self.viewModel.reset()
              self.showMenu.toggle()
          }, resetScoreAction: {
              self.viewModel.eraseBestScore()
              self.showMenu.toggle()
          })
      }
  }
  
  private func GameOver() -&gt; some View {
      EmptyView().sheet(isPresented: $viewModel.isGameOver) {
          GameOverView(score: self.viewModel.state.score, moves: self.viewModel.numberOfMoves) {
              self.viewModel.reset()
          }
      }
  }
  }
  
  struct ResultView2: View {
      var choice: String
      var body: some View {
          Text(&quot;You chose Menu2&quot;)
      }
  }
  </code></pre>