title: how to return array from Dispatch.notify (swift)
body: <p>I want to return an array of folders from the function using dispatch.notify() but it won't allow me to do. I have tried printing it out after notify but it is an empty array (It should have data from firestore query). Anyone have a suggestion to implement this ?</p>
  
  <pre><code>var folders = [Folder]()
  var dispatch = DispatchGroup()
  
  func getFolders() {
      self.dispatch.enter()
      print("--- Enter Dispatch ---")
      self.userFolders.getDocuments() { (querySnapshot, err) in
          if let err = err {
              print("Error getting Folders: \(err)")
          }
          else {
              for document in querySnapshot!.documents {
                  let folder = Folder(name: document.documentID, menu: document.data())
                  self.folders.append(folder)
              }
          }
          self.dispatch.leave()
          print("--- Leave Dispatch ---")
      }
  }
  
  func getFoldersData() -&gt; [Folder] {
      getFolders()
      self.dispatch.notify(queue: .main) {
          print("--- Notify Dispatch ---")
      }
      return folders // This one return folders = []
  }
  </code></pre>