JSON Parsing, Conversion, and Caching in the Apollo iOS GraphQL Client

JSON Parsing, Conversion, and Caching in the Apollo iOS GraphQL Client

In my last post I took a closer look at how the Apollo iOS GraphQL client executes queries and what the resulting JSON looks like. In this post I’m going to focus on how the JSON is parsed and converted to the native Swift types generated by the apollo-codegen tool and also look at how the Apollo iOS client caches results.

JSON Parsing, Conversion, and Caching in the Apollo iOS GraphQL Client

Exploring GraphQL on iOS

GraphQL is a “query language for your API” developed by Facebook back in 2012 for use in its mobile apps, which in 2015 became a published open source specification and framework. Its development was driven by frustration with the state of REST-like endpoints and development of mobile and web apps to consume them.
I hadn’t worked with GraphQL before, but it looked interesting and wanted to see if we could put it to use in the mobile or web apps we build.