title: Error: Cannot Convert Value of Type "CueCardModel" to Closure Result Type "Void" SwiftUI
body: <p>I am trying to make a Cue Card App. I have my DataDownloader class put my Firebase Database into an array, which the array passes to my CueCardViewModel, that returns a term and answer from a specific index to my CueCardView.</p>
  <p>Confusing...so basically, the CueCardView should be able to call on the CueCardViewModel to get a term and answer at a specific index from the DataDownloader class. The problem I am having is the CueCardViewModel won't return. I am new to Swift and have tried searching for a way to do this, but I am confused because most videos/forums seem to be hardcoding their database so I am having trouble.</p>
  <p><a href="https://i.stack.imgur.com/l8mxi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l8mxi.png" alt="CueCardViewModel Error Picture" /></a></p>
  <p>CueCardView:</p>
  <pre><code>import SwiftUI
  
  struct CueCardView: View
  {
  var viewModel = CueCardViewModel()
  @State private var isShowingAnswer = false
  var body: some View
  {
      ZStack
      {
          RoundedRectangle(cornerRadius: 25, style: .continuous)
              .fill(Color.white)
          VStack
          {
              var a = getCue()
              Text(a)
                  .onAppear
                  {
                      self.viewModel.initializeCues(index: 1)
                  }
          }
          .padding(20)
          .multilineTextAlignment(.center)
      }
      .onTapGesture
      {
          self.isShowingAnswer.toggle()
      }
    }
  }
  
  extension CueCardView {
  func getCue() -&gt; String{
      return &quot;BBBBBBB&quot;
   }
  }
  struct C1_Previews: PreviewProvider {
  static var previews: some View {
      CueCardView().previewDevice(&quot;iPhone 12&quot;)
   }
  }    
  </code></pre>
  <p>CueCardModel:</p>
  <pre><code>import SwiftUI
  
  struct CueCardModel : Identifiable {
    var id: String = UUID().uuidString
    var term: String
    var answer: String
  }
  </code></pre>
  <p>DataDownloader:</p>
  <pre><code>import SwiftUI
  import Firebase
  
  var dbRef = Firestore.firestore()
  struct DataDownloader {
    func downloadCues(completion: @escaping ([CueCardModel]) -&gt; Void) {
      var array = [CueCardModel]()
      dbRef.collection(&quot;Cue&quot;).getDocuments(){(snap, err) in
          if let err = err {
              print(err)
          } else {
              guard let snap = snap else {return}
              for doc in snap.documents {
                  let id = doc.documentID
                  let term = doc.get(&quot;term&quot;) as! String
                  let answer = doc.get(&quot;answer&quot;) as! String
                  let cue = CueCardModel(id: id, term: term, answer: answer)
                  array.append(cue)
              }
              completion(array)
          }
      }
    }
  }
  </code></pre>
  <p>CueCardViewModel:</p>
  <pre><code>import SwiftUI
  import Firebase
  
  class CueCardViewModel: ObservableObject {
  
  let dataDownloader = DataDownloader()
  
  
  func initializeCues(index :Int) -&gt; [CueCardModel] {
      dataDownloader.downloadCues{array in
          return array[0]
      }
   }
  }
  </code></pre>