REST is the de facto standard for API design nowadays – however, it actually has a number of shortcomings in flexibility and performance. For example, it usually requires multiple roundtrips between client and server to fetch data that goes over one or more relations in the data model. Adjusting the API on the other hand requires a lot of overhead from the backend engineers and is time consuming and error-prone.
In 2015, Facebook introduced a new API design paradigm called GraphQL as an alternative to REST – responding to the need making the data transfer in their mobile apps more efficient. It allows the client developer to specify arbitrary data requirements upon every API request, omitting the need for backend developers to adjust the API just because the client might need different data for a specific screen. Data that would have required a huge number of API calls to be fully available in the client now can be fetched with a single request.
This talk introduces the basic functionality of GraphQL as well as the Apollo Client, which is an iOS framework written in Swift that handles data fetching and mutations against a GraphQL backend. The Apollo Client leverages Swift’s static type system by generating the Swift types that correspond to your data requirements at compile time. It also features a normalized cache of the server responses that allows for automatic UI updates.
I have been developing on iOS for roughly 5 years. I worked for bigger companies like SAP as well as smaller startups, did freelance projects and worked on some personal apps as well. I attended WWDC 14 on a student scholarship and have been excited about Swift and its functional programming features since. In 2016, I spent half a year in San Francisco to work as an iOS instructor at a tech education startup called Make School. After returning to Germany I joined Graphcool, a Berlin based startup where we build a Backend-as-a-Service based on GraphQL.