Is there a better way to send the non hardcode key as define below
ref: Direct cache access - Apollo GraphQL Docs - Apollo Doc
let data = try transaction.readObject(
ofType: HeroDetails.self,
withKey: "Hero:123"
)
The reason is when we update the sdk, we missed to change the cacheKey format and we hit into issue. Trying to avoid such things in future.
We set the format of cacheKeyInfo as below, as defined in doc.
cacheKeyInfo(for type: ApolloAPI.Object, object: ApolloAPI.ObjectData) -> CacheKeyInfo? {
guard let id = object["id"] as? String else {
return nil
}
return CacheKeyInfo(id: id)
}