Skip to content

Update to Apollo 2.0.4 - #10

Merged
jmarek41 merged 5 commits into
mainfrom
feature/Update-to-Apollo-2.0.4
Aug 21, 2026
Merged

Update to Apollo 2.0.4#10
jmarek41 merged 5 commits into
mainfrom
feature/Update-to-Apollo-2.0.4

Conversation

@ssestak

Copy link
Copy Markdown
Contributor

This PR upgrades apollo-ios to version 2.0, modernizing the API to use async/await and improving the overall architecture. The adapter initialization is now handled by a dedicated GraphQLAPIConfiguration struct, and completion handlers have been replaced with throwing async functions. The interceptor system has been updated to align with the new standards in Apollo 2.0.

Key Features

  • Upgraded Apollo iOS: The core dependency apollo-ios has been updated from version 1.17.0 to 2.0.4.
  • Async/Await API: The GraphQLAPIAdapter now uses async/await for fetch and perform methods, replacing the previous completion handler-based approach.
  • Configuration Structs:
    • GraphQLAPIConfiguration has been introduced to provide a cleaner and more robust way to configure the adapter.
    • GraphQLRequestConfiguration allows for per-request customizations, such as adding extra headers.
  • Updated Interceptor Chain: The interceptor implementation has been refactored to conform to the new InterceptorProvider architecture in Apollo iOS 2.0.
  • Improved Error Handling: Error mapping has been enhanced to correctly handle URLError and CancellationError, providing more specific error types like .connection and .cancelled.
  • Dependency Cleanup: The SQLite.swift dependency, which is no longer required by Apollo 2.0, has been removed.

API Migration

FeatureBefore (Apollo 1.x)After (Apollo 2.x)
InitializationGraphQLAPIAdapter(url: ...)let config = GraphQLAPIConfiguration(url: ...)
GraphQLAPIAdapter(configuration: config)
Fetch Queryadapter.fetch(query: q) { result in ... }let data = try await adapter.fetch(query: q)
Perform Mutationadapter.perform(mutation: m) { result in ... }let data = try await adapter.perform(mutation: m)
Request HeadersRequestHeaders protocol used as a context object.GraphQLRequestConfiguration struct passed to methods.

Šimon Šestákand others added 4 commits January 14, 2026 14:50
BREAKING CHANGE: Public API now uses native async/await instead of callbacks.
- Update Apollo dependency from 1.17.0 to 2.0.4
- Rewrite interceptors for new Apollo 2.0 architecture
- Replace callback-based API with async throws
- Add NoCacheInterceptor for explicit cache-less operation
- Remove ObserverContextStore (single interceptor pattern)
- Add Sendable conformance to error types
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…uests
Introduce `GraphQLAPIConfiguration` and `GraphQLRequestConfiguration` structs to simplify and centralize the configuration for the `GraphQLAPIAdapter` and individual GraphQL requests.
The `README.md` has been updated to reflect the new Apollo iOS dependency version and the updated usage of `GraphQLAPIAdapter` which now requires a configuration object and uses `async throws` for fetch and perform operations.
Corrected `swiftPackageManager` to `swiftPackage` in configuration example and fixed typo in Xcode build phase script instructions. Updated the `apollo-ios-cli` binary.
Resolve conflicts by keeping the new API from HEAD:
- GraphQLAPIConfiguration-based initialization
- Async/await API with throws
- Simplified NetworkInterceptorProvider
- URLError handling in GraphQLAPIAdapterError
- Updated tests for new API
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@jmarek41
jmarek41 merged commit 1a7c84c into mainAug 21, 2026
2 checks passed
@jmarek41
jmarek41 deleted the feature/Update-to-Apollo-2.0.4 branch August 21, 2026 15:58
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@ssestak@samoilyk@jmarek41