Skip to content

Releases: apollographql/apollo-ios

2.2.0

24 Jun 18:49

Choose a tag to compare

Fixed

  • Xcode 27 (Swift 6.4) build compatibility (#1034): Fixed multiple build failures introduced by Swift 6.4 / Xcode 27. AnyHashable's Sendable conformance is now explicitly unavailable in Swift 6.4, so AnyHashable as JSONValue casts no longer compile; replaced with explicit scalar type-matching helpers (with Bool checked before NSNumber to preserve round-trip fidelity). Fixed a duplicate runtime type descriptor crash caused by multiple test targets statically linking the same SPM products; all Apollo package products are now linked exclusively through a single apolloWrapper target. Fixed WebSocketConnection.send() silently discarding errors by cancelling the underlying task on failure so the transport's reconnection state machine runs correctly. Also fixed \x22 escapes in composed Swift Regexes and AsyncResultObserver.handler @Sendable conformance under Swift 6.4. Thank you to the community members who submitted PRs identifying these issues.
  • Fix WebSocketTransport retain cycle in receive loop (#1011): The WebSocketTransport actor was never deallocated after a connection was established because the unstructured Task in startConnectionReceiveLoop() captured self strongly. The receive loop now uses [weak self] and deinit explicitly closes the connection so the transport deallocates correctly when all external references are dropped. Thank you to @heltoft for the contribution.
  • Fix crash in SelectionSet equality for nullable-inner object lists (#986): Comparing two SelectionSet values containing a [Object?] (non-null list, nullable element) field where any element was null triggered a preconditionFailure("Expected list data to contain objects."). Added a [DataDict?] branch in convertElements that handles the mixed DataDict + NSNull case and preserves null positions so position-sensitive equality remains correct. Thank you to @dfed for the contribution.

2.1.2

08 May 20:07

Choose a tag to compare

Fixed

  • Make SubscriptionStream initializer public (#975): The SubscriptionStream initializer was inadvertently scoped to package access, preventing adopters from writing custom conformances to the public SubscriptionNetworkTransport protocol. The initializer is now public. Fixes #3637. Thank you to @ahou8 for raising the issue.
  • Fix \r\n in GraphQL descriptions generating invalid Swift comments (#961): GraphQL field descriptions containing \r\n (Windows CRLF) line endings caused codegen to emit invalid Swift — only the first line received the /// doc comment prefix and subsequent lines were emitted as uncommented text, breaking compilation. Fixes #3553. Thank you to @iPhoneNoobDeveloper for the contribution.

1.25.6

08 May 20:35

Choose a tag to compare

Fixed

  • Fix \r\n in GraphQL descriptions generating invalid Swift comments (#965): GraphQL field descriptions containing \r\n (Windows CRLF) line endings caused codegen to emit invalid Swift — only the first line received the /// doc comment prefix and subsequent lines were emitted as uncommented text, breaking compilation. Backport of #961. Fixes #3553. Thank you to @iPhoneNoobDeveloper for the contribution.

2.1.1

23 Apr 18:07

Choose a tag to compare

Fixed

  • Fix cache read failure for nested arrays of objects (#938): Reading nested arrays of objects (2D, 3D, etc.) from the normalized cache threw a JSONDecodingError.wrongType error. Reference resolution now handles array nesting at any depth. Fixes #3609. Thank you to @gurusekhar-ibm for raising the issue.
  • Fix incorrect default mock value when first enum case is deprecated (#949): When deprecatedEnumCases was set to .exclude, the mock codegen incorrectly used the first enum case as the default value in convenience initializers — even if that case was deprecated and excluded from the generated enum, causing a compile error. Fixes #3634. Thank you to @cswelin for raising the issue.
  • Fix recursive OneOf input object enum cases not marked indirect (#954): A @oneOf input object that directly references itself generated a Swift enum that failed to compile with Recursive enum is not marked 'indirect'. Self-referencing cases are now correctly marked indirect. Fixes #3633. Thank you to @ahou8 for raising the issue.

1.25.5

07 Apr 18:26

Choose a tag to compare

Fixed

  • Fixed concurrency crash in compileGraphQLResult on Swift 6.3/macOS 26 (#929): Serialized async let calls in compileGraphQLResult to work around a Swift concurrency runtime crash triggered when code generation is used in an AsyncParsableCommand. See PR #942. Thank you to @m4p for the contribution.

2.1.0

02 Apr 18:02

Choose a tag to compare

New

  • WebSocket Transport: Apollo iOS 2.0 now supports WebSocket connections using the graphql-transport-ws protocol for subscriptions, queries, and mutations. See the WebSocket Transport documentation for setup and usage details.
  • Swift 6.2 MainActor default isolation support (#925): Added a markTypesNonisolated codegen option that emits nonisolated on all generated type declarations. This prevents compilation errors when SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor is enabled. The option defaults to true when the codegen tool is compiled with Swift 6.2+.
  • ApolloURLSession delegate injection (#899): Added support for injecting a custom URLSessionTaskDelegate into ApolloURLSession, enabling delegate callback handling. Thank you to @hammy-e for the contribution.

Fixed

  • Fix concurrency issue in compileGraphQLResult (#929): Resolved a Swift compiler crash triggered by async let stack management during code generation in AsyncParsableCommand contexts. Thank you to @m4p for the contribution.

New

  • WebSocket Transport: Apollo iOS 2.0 now supports WebSocket connections using the graphql-transport-ws protocol for subscriptions, queries, and mutations. See the WebSocket Transport documentation for setup and usage details.
  • ApolloURLSession delegate injection (#899): Added support for injecting a custom URLSessionTaskDelegate into ApolloURLSession, enabling delegate callback handling. Thank you to @hammy-e for the contribution.
  • Make JSONRequest.useGetForQueries mutable (#897): The useGetForQueries property on JSONRequest is now a var, allowing interceptors to mutate the request directly instead of copying it. Thank you to @nevil for the contribution.

Fixed

  • Add preflight HTTP header for CSRF prevention (#900): Added the X-Apollo-Operation-Name header to requests to satisfy Apollo Router's CSRF prevention requirements.

Improved

  • Use dictionary for objectType(forTypename:) lookup (#918): Replaced the generated switch statement in SchemaMetadata.objectType(forTypename:) with a static dictionary lookup, improving deserialization performance by ~75% for schemas with many types (4000+). Thank you to @erneestoc for the contribution.

1.25.4

25 Mar 21:32

Choose a tag to compare

Improvement

  • Use dictionary instead of switch for objectType(forTypename:) lookup (#3631): The generated SchemaMetadata.objectType(forTypename:) method now uses a static dictionary for O(1) hash-based lookup instead of a switch statement that performed O(n) linear scanning. For schemas with many object types (~4300 types), this improves deserialization times by approximately 75%. See PR #926.

2.1.0-rc-1

23 Mar 18:16

Choose a tag to compare

2.1.0-rc-1 Pre-release
Pre-release

New

  • WebSocket Transport: Apollo iOS 2.0 now supports WebSocket connections using the graphql-transport-ws protocol for subscriptions, queries, and mutations. See the WebSocket Transport documentation for setup and usage details.
  • ApolloURLSession delegate injection (#899): Added support for injecting a custom URLSessionTaskDelegate into ApolloURLSession, enabling delegate callback handling. Thank you to @hammy-e for the contribution.
  • Make JSONRequest.useGetForQueries mutable (#897): The useGetForQueries property on JSONRequest is now a var, allowing interceptors to mutate the request directly instead of copying it. Thank you to @nevil for the contribution.

Fixed

  • Add preflight HTTP header for CSRF prevention (#900): Added the X-Apollo-Operation-Name header to requests to satisfy Apollo Router's CSRF prevention requirements.

Improved

  • Use dictionary for objectType(forTypename:) lookup (#918): Replaced the generated switch statement in SchemaMetadata.objectType(forTypename:) with a static dictionary lookup, improving deserialization performance by ~75% for schemas with many types (4000+). Thank you to @erneestoc for the contribution.

2.0.6

06 Feb 20:24

Choose a tag to compare

Fixed

  • Fix HTTP method selection (#877): The APQ retry logic was overriding the HTTP method selected for all queries. Thank you to @3redrubies for raising the issue.
  • Prevent crashes in Dictionary initialization with duplicate keys (#884): Dictionary initialization using literal elements now uses a safer internal initializer to prevent crashes when duplicate keys are used. In the event that duplicate keys are present, the value associated with the first key will override all other values. Thank you to @adysart for raising the issue.

2.0.5

15 Jan 19:11

Choose a tag to compare

  • Fix data race in AsyncReadWriteLock (#862): This fixes issue #3616. Thank you to @AlexPan1992 for raising the issue.
  • Set URLRequest.cachePolicy on GET requests (#859): Thank you to @samjdurante for the contribution.