title: Populating UITableView from Firestore
body: <p>This feels very basic but I can't get it to work. The content read from FIrestore is not displayed in the tableview. From what I can gather the tableview is rendered before the <code>scheduleArray</code> array is populated from FIrestore. If I make the <code>scheduleArray</code> literal everything works just fine.
  The print statement in <code>loadData()</code> function prints the content of the db just fine. So the connection to Firestore is working as expected.</p>
  
  <p>How do I get the db read and array population to occur before the rendering of the tableview?</p>
  
  <pre><code>class ListScheduleViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
  
      var scheduleIDarray = [String]() // &lt;-- If this is made an array literal, everything works
      var db: Firestore!
      override func viewDidLoad() {
          super.viewDidLoad()
  
          db = Firestore.firestore()
          loadData()
  
      }
      func loadData() {
          db.collection("schedules").getDocuments() { (querySnapshot, err) in
              if let err = err {
                  print("Error getting documents: \(err)")
              } else {
                  for document in querySnapshot!.documents {
  
                      self.scheduleIDarray.append(document.documentID)
                  }
              }
              print(self.scheduleIDarray) // &lt;-- This prints the content in db correctly
          }
      }
         @IBOutlet weak var tableView: UITableView!
  
      //Tableview setup
      func numberOfSections(in tableView: UITableView) -&gt; Int {
  
          return 1
      }
  
      func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -&gt; Int {
  
                  print("Tableview setup \(scheduleIDarray.count)")
          return scheduleIDarray.count
      }
  
      func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -&gt; UITableViewCell {
          let cell = tableView.dequeueReusableCell(withIdentifier: "customScheduleCell", for: indexPath) as! customScheduleviewCell
          let schedule = scheduleIDarray[indexPath.row]
  
          cell.scheduleName.text = schedule
          print("Array is populated \(scheduleIDarray)")
          return cell
      }
  
  }
  </code></pre>