79257709

Date: 2024-12-06 10:53:08
Score: 1
Natty:
Report link

Snapshot Listeners allow you retrieve data from Firestore in real time.

EXAMPLE:

The first use case of AddSnapshotListener that comes to my mind is updating a collection.

Imagine you have a gallery of images. Those images are generated by a third party API and then stored in a Firestore collection. Whenever a new image is generated and stored in your Firestore collection, you want to update your client view showing your new image.

To do so you attach a listener to the image collection. Whenever the collection changes you get notified by the listener and you can update your image gallery on SwiftUI.

I also found this tutorial that is very insightful: https://peterfriese.github.io/MakeItSo/tutorials/makeitso/03-retrieving-data-from-cloud-firestore-in-real-time/

Reasons:
  • Blacklisted phrase (1): this tutorial
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: Federica Bucchieri