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

@ssestak ssestak commented Jan 14, 2026

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

Feature Before (Apollo 1.x) After (Apollo 2.x)
Initialization GraphQLAPIAdapter(url: ...) let config = GraphQLAPIConfiguration(url: ...)
GraphQLAPIAdapter(configuration: config)
Fetch Query adapter.fetch(query: q) { result in ... } let data = try await adapter.fetch(query: q)
Perform Mutation adapter.perform(mutation: m) { result in ... } let data = try await adapter.perform(mutation: m)
Request Headers RequestHeaders protocol used as a context object. GraphQLRequestConfiguration struct passed to methods.

Šimon Šesták and 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.
@ssestak
ssestak requested review from jmarek41 and samoilyk January 14, 2026 19:59
Comment thread Sources/GraphQLAPIKit/Configuration/GraphQLAPIConfiguration.swift
Resolve conflicts by keeping the new API from HEAD:
- GraphQLAPIConfiguration-based initialization
- Async/await API with throws
- Simplified 网络InterceptorProvider
- 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 main Aug 21, 2026
2 checks passed
@jmarek41
jmarek41 deleted the feature/Update-to-Apollo-2.0.4 branch August 21, 2026 15:58
注册 for free to join this conversation on GitHub. Already have an account? 登录 to comment

标签

None yet

项目

None yet

Development

Successfully merging this pull request may close these issues.

3 participants