func loadQuery()

in firestore/swift/firestore-smoketest/SolutionBundles.swift [71:95]


  func loadQuery(named queryName: String,
                 fromRemoteBundle bundleURL: URL,
                 with store: Firestore,
                 completion: @escaping ((Result<Query, Error>) -> ())) {
    fetchRemoteBundle(for: store,
                      from: bundleURL) { (result) in
      switch result {
      case .success:
        store.getQuery(named: queryName) { query in
          if let query = query {
            completion(.success(query))
          } else {
            completion(
              .failure(
                self.bundleLoadError(reason: "Could not find query named \(queryName)")
              )
            )
          }
        }

      case .failure(let error):
        completion(.failure(error))
      }
    }
  }