Is there a way to tell if a query response is coming from the cache or the network?

As the title says, is there a way to tell if the response is coming from the cache or the network when I use the returnCacheDataAndFetch for cachePolicy?

Ideally depending on whether the data is coming from the cache or not, the UI will behave differently.

I am working on an iOS Swift project.

Yes! There is a Source enum on GraphQLResult that is represented in a property called, unsurprisingly, source.

It won’t give you any details about what the cache policy was when something was requested, but it will tell you whether the data is from the cache or the server.

1 Like

Thank you! I was looking in the wrong place all that time.