Seems like a simple question, but if I call:
query.observeSingleEvent(of: .value ...
then I always get data that's been persisted locally. The only way to get around this (that I've found) is to set up an observer that continues observing indefinitely.
For example, say I have an app where I'm viewing a user's profile. That user's data gets persisted locally. I come back ten days later to the same profile. That user has changed his name (or something). I only need to observe a single event, but that single event will give me the cached data (which is now out-of-date). I don't want to set up a continuous observer for every user profile I visit, because that will cause unnecessary updates (say I never come back to this profile again).
Anyway, I hope this question is clear. Would appreciate any insights.
EDIT:
What I ended up doing as a workaround is to simply call observe(.value) and let it respond twice. The first response is from the cache; the second from the server. This helps in cases where you're not guaranteed to have a connection as soon as you make the request.