You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to ensure when a document is deleted from firestore, that results in the map annotation from my observe query being removed.
I'm maintaining the results of .documentedEntered in a published array
@PublishedvarmapStreams=[Stream]()init(){loadData()}func loadData(){letgeoResults= geoFire.query(withCenter:GeoPoint(latitude:35.111521, longitude:-40.987951), radius:5000)let _ = geoResults.observe(.documentEntered, with:{(key, location)iniflet key = key,let loc = location {letdoc= playbackRef.document("\(key)")
doc.getDocument{(document, error)inletresult=Result{try document?.data(as:Stream.self)}switch result {case.success(let stream):iflet stream = stream {
// A `City` value was successfully initialized from the DocumentSnapshot.
self.mapStreams.append(stream)}else{
// A nil value was successfully initialized from the DocumentSnapshot,
// or the DocumentSnapshot was nil.
print("Document does not exist")}case.failure(let error):
// A `City` value could not be initialized from the DocumentSnapshot.
print("Error decoding stream: \(error)")}}}})}
What I realized is this only is accurate when my app is opened, but it's not acting as a snapshotListener if a document is modified or deleted. How do I ensure I monitor firestore for deletes or updates to a document?
The text was updated successfully, but these errors were encountered:
Trying to ensure when a document is deleted from firestore, that results in the map annotation from my observe query being removed.
I'm maintaining the results of .documentedEntered in a published array
What I realized is this only is accurate when my app is opened, but it's not acting as a snapshotListener if a document is modified or deleted. How do I ensure I monitor firestore for deletes or updates to a document?
The text was updated successfully, but these errors were encountered: