/
Launch Apollo Studio

Introduction

A strongly-typed, caching GraphQL client for iOS, written in Swift


Apollo iOS is a strongly-typed, caching GraphQL client for native iOS apps written in Swift.

It allows you to execute queries and mutations against a GraphQL server and returns results as query-specific Swift types. This means you don't have to deal with parsing JSON, or passing around dictionaries and making clients cast values to the right type manually. You also don't have to write model types yourself, because these are generated from the GraphQL definitions your UI uses.

As the generated types are query-specific, you're only able to access data you actually specify as part of a query. If you don't ask for a field in a particular query, you won't be able to access the corresponding property on the returned data structure.

In effect, this means you can now rely on the Swift type checker to make sure errors in data access show up at compile time. With our Xcode integration, you can conveniently work with your UI code and corresponding GraphQL definitions side by side, and it will even validate your query documents, and show errors inline.

Apollo iOS does more than simply run your queries against a GraphQL server, however. It normalizes query results to construct a client-side cache of your data, which is kept up to date as further queries and mutations are run. This means your UI is always internally consistent, and can be kept fully up-to-date with the state on the server with the minimum number of queries required.

This combination of immutable models, one way data flow, and automatic consistency management, leads to a very powerful and elegant programming model that allows you to eliminate common glue code and greatly simplifies app development.

Getting Started

We have a detailed iOS tutorial walking you through how to build an app called RocketResever, which talks to the backend built in the Fullstack Tutorial.

If you have questions or would like to contribute, please join our community at https://community.apollographql.com/.

Apollo Android is a GraphQL client for native Android apps written in Java and Kotlin, and offers Kotlin Multi-Platform integration as well.

Apollo Client for JavaScript's React integration works with React Native on both iOS and Android.

Other resources

  • GraphQL.org for an introduction and reference to the GraphQL itself, partially written and maintained by the Apollo team.
  • Our website to learn about Apollo open-source and commercial tools.
  • Our blog for long-form articles about GraphQL, feature announcements for Apollo, and guest articles from the community.
  • Our Twitter for in-the-moment news.
Edit on GitHub