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, you won't be able to access the corresponding property. 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: 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 models with value semantics, 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.
If you are new to GraphQL, start with the tutorial that will guide you through building an iOS app using Swift and Apollo iOS. There is also comprehensive documentation of the SDK, including an API reference.
The roadmap is a high-level document that describes the next major steps or milestones for this project. We are always open to feature requests, and contributions from the community.
This project is being developed using Xcode 12.5 and Swift 5.4.
If you open
Apollo.xcodeproj, you should be able to run the tests of the Apollo, ApolloSQLite, and ApolloWebSocket frameworks on your Mac or an iOS Simulator.
NOTE: Due to a change in behavior in Xcode 11's git integration, if you check this repo out using Xcode, please close the window Xcode automatically opens using the Swift Package manager structure, and open the
Some of the tests run against a simple GraphQL server serving the Star Wars example schema (see installation instructions there).
If you'd like to contribute, please refer to the Apollo Contributor Guide.
Apollo Graph, Inc. creates industry-leading tools for building applications with GraphQL:
We are fully committed to advancing the frontier of graph development with open-source libraries, hosted software tooling, developer extensions, and community contributions.
|Last commit: 2 days ago|
ApolloWebSocketClientprotocol was removed and replaced with
WebSocketClientdoes not rely directly on Starscream anymore and has been streamlined for easier conformance.
ApolloWebSocket, the default implementation of the
WebSocketClienthas been replaced with
DefaultWebSocket. This implementation uses Starscream, but implementations using other websocket libraries can now be created and used with no need for Starscream.
WebSocketClientDelegatereplaces direct dependency on
WebSocketTransportis now initialized with an
ApolloWebSocket(or other object conforming to the
ApolloWebSocketClientprotocol.) Previously, the initializer took in the necessary parameters to create the web socket internally. This provides better dependency injection capabilities and makes testing easier.
ApolloInterceptorand converted to structs for all interceptors that could be structs instead of classes.
removeRecords(matching pattern: CacheKey)function to the normalized cache.