title: Need to fire completion block immediately after CloudKit query
body: <p>I'm stuck on the idea of how to write a CloudKit completion block. My issue is I am loading data, then putting the data in a tableView. The problem is I have to refresh the tableView manually with a button instead of it loading the data to it automatically. What I need is a completion block at the end of my query to reload the table data. Below is my query function:</p>
  
  <pre><code>func loadGroupPage() {
      print("should go")
      // let pred = NSPredicate(format: "Username = %@", usernameText)
      let pred = NSPredicate(format: "groupName = %@", "\(selectedCellName)")
      let query = CKQuery(recordType: "Group", predicate: pred)
      let operation = CKQueryOperation(query: query)
      //operation.resultsLimit = CKQueryOperationMaximumResults
      operation.recordFetchedBlock = { (record: CKRecord!) in
         operation.qualityOfService = .default
  
          if record != nil{
  
              // setup screen after loading data
  
              self.recordToUpdate = record
  
              if creatingNewPost == true{
                  print(feed)
                  //create new post record (modify record)
                  feed.append(postText)
                  creatingNewPost = false
                  self.saveNewPost()
              }
  
              self.publicOrPrivate = (record.object(forKey: "PublicOrPrivate") as! String)
              if self.publicOrPrivate == "Public"{
                  // public
                  //print("you have joined")
  
              }else if self.publicOrPrivate == "Private"{
                  // private
                  //print("requestSent")
                  // self.sendRequest()
                   self.requests = (record.object(forKey: "Requests") as! Array)
              }
              if self.groupMembs.contains(username) || members.contains(username){
                  self.joinBtn.alpha = 0
                  // in group
              }else{
                  self.joinBtn.alpha = 1
              }
              if self.leaders.contains(username) &amp;&amp; self.publicOrPrivate == "Private"{
                  // leader
                  self.requestsTableView.alpha = 1
              }else{
                  self.requestsTableView.alpha = 0
              }
              if self.groupMembs.contains(username) || self.publicOrPrivate == "Public"{
                  // leader
  
                  feed = (record.object(forKey: "groupFeed") as! Array)
                  print(feed)
              }else{
  
              }
              self.groupMembs = (record.object(forKey: "memberUsernames") as! Array)
  
              print(self.groupMembs)
              self.numberOfMembersInGroup = self.groupMembs.count
              self.groupNameLbl.text = selectedCellName
              self.numberOfMembersLbl.text = "\(self.numberOfMembersInGroup) Members"
              self.leaders = (record.object(forKey: "leaders") as! Array)
  
              //****************************************************
              // this does nothing until I refresh it manually!
              self.requestsTableView.reloadData()
              self.groupFeedTableView.reloadData()
              //****************************************************
              //Need completion block so the above two lines will fire directly after data is done loading!
          }
  
      }
      database.add(operation)    
  }
  </code></pre>
  
  <p>As I documented in the code above, refreshing the table there will not load anything in the actual UI. Can someone please write a completion block that simply reloads the tableView(s) for me?  Thanks!</p>