I'm following along with the official Firestore docs to create an app using geohashes and geoqueries (https://firebase.google.com/docs/firestore/solutions/geoqueries#query_geohashes)
I'm trying to add a listener to that query but I get the following error:
Declared closure result 'ListenerRegistration' is incompatible with contextual type 'Query'. I'm stumped because XCode recommends I replace "Query" with "Query" :D
All I did was add this listener to the sample code I linked above:
var queries = queryBounds.map { bound -> Query in
return db.collection("cities")
.order(by: "geohash")
.start(at: [bound.startValue])
.end(at: [bound.endValue])
.addSnapshotListener { querySnapshot, error in
guard let documents = queries?.documents else {
print("Error fetching documents: \(error!)")
return
}
let cities = documents.map { $0["name"]! }
print("Current cities in CA: \(cities)")
}
}