What is the correct way of performing work on a non-main queue using CombineFirebase?
For example, using .getDocument(as:) to transform the data into a model object (in this case City). From the Combine docs it looks like adding subscribe(on:) should ensure the upstream operations are performed on the specified scheduler.
However, when debugging it looks like this is not the case. Is there an issue with my code, or is it related to the implementation of this library? Thanks.
func getDocumentAsObject() {
db.collection("cities")
.document("SF")
.getDocument(as: City.self)
.subscribe(on: DispatchQueue.global(qos: .userInitiated)) // move upstream work onto non-main thread...
.sink(receiveCompletion: { (completion) in
switch completion {
case .finished: print("🏁 finished")
case .failure(let error): print("❗️ failure: \(error)")
}
}) { city in
print("City: \(city)")
}
.store(in: &cancelBag)
}
Just passing through and got curious about this issue. Was wondering if the answer here regarding forcing things to the background queue happens to be of value: https://stackoverflow.com/a/58898411/2640516
What is the correct way of performing work on a non-main queue using CombineFirebase?
For example, using
.getDocument(as:)
to transform the data into a model object (in this caseCity
). From the Combine docs it looks like addingsubscribe(on:)
should ensure the upstream operations are performed on the specified scheduler. However, when debugging it looks like this is not the case. Is there an issue with my code, or is it related to the implementation of this library? Thanks.