Skip to content

Add example for direct writing to the cache #1440

@michael-mckenna

Description

@michael-mckenna

Feature request

Add examples for writing directly to the cache, hopefully for all variants of the "write" function:

transaction.write(object:withKey:)
transaction.write(data:forQuery:)
transaction.write(object:withKey:variables:)

Looks like only read and update are in the docs at the moment.
https://github.com/apollographql/apollo-ios/blob/main/docs/source/caching.mdx#direct-cache-access

Motivation

I'm new to GraphQL and using it for a side project has a learning experience. I don't want to get the whole server and datasource set up yet - would like to just do the iOS portion and have some sort of proof of concept going before pursuing it further. Because of this, I'm using the direct cache access exclusively for now. The extra examples in the readme will help me and future devs a lot. I come from using Realm and Core Data so this is quite a bit different for me.

Outstanding Questions

Is there a sample app that utilizes direct cache access? If so, it'd be great to add a reference to that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cachingdocsFocuses on documentation changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions