urban-health-labs / CombineFirebase

Combine wrapper on Google's iOS Firebase library.
MIT License
225 stars 45 forks source link

how to use getDocuments? #5

Closed Pasta closed 4 years ago

Pasta commented 4 years ago

Hi,

super useful library! I'm trying to get a list of documents.

Looks like there is a getDocuments() function, but

` environment.service.collection("collections").whereField("userId", isEqualTo: userId) .getDocuments() .sink(receiveCompletion: { completion in switch completion { case .finished: print("🏁 finished") case .failure(let error): print("❗️ failure: (error)") } }) { snapshot in doSomething(snapshot) }.store(in: &cancelBag)

` but sink and doSomething are never called even when get public func getDocuments(source: FirestoreSource = .default) -> AnyPublisher<QuerySnapshot, Error> returns a successful promise. What am I doing wrong?

Pasta commented 4 years ago

Actually managed to make this work =)