Releases: apollographql/apollo-ios
Releases · apollographql/apollo-ios
Release list
2.3.0
New
- Add opt-in
additionalCapitalizationRulesto codegen (#1037): Adds a new opt-inadditionalCapitalizationRulescodegen option and publicCapitalizationRuleAPI (aTermof.string/.regexand aCaseStrategyof.upper/.lower) so acronyms can be fully capitalized (e.g.userId→userID). Following SwiftFormat semantics, an acronym is only capitalized when its first character is already uppercase, so identifiers likeapiKeyare preserved. The rules apply to field accessors, initializer parameters, enum cases, input fields, and test mocks. The option defaults to empty, so existing generated output is unchanged. Closes #3419. Thank you to @3redrubies for the contribution.
Fixed
- Resolve deferred response paths against the initial cache records (#1052): When a
@deferquery streamed incremental chunks, the deferredpathwas turned into a cache key by naively joining the root key with the raw path components (e.g.QUERY_ROOT.animal.friend) instead of following the real normalized-record chain (QUERY_ROOT → Animal:<id> → …). The deferred fields landed on phantom records that nothing referenced, so a cache-first read came back missing those fields. Deferred paths are now resolved by walking the initial response's already-normalized records at parse time, so deferred fields merge onto the correct records. Fixes #3380. Thank you to @joseph-francis-ih for the contribution. - Close the old connection in
WebSocketTransport.disconnectAndReconnect()(#1055):disconnectAndReconnect()replaced the active connection without closing the old one first. Because the oldWebSocketConnectionwas strongly held by its receive loop's parkedTask, it never deallocated — leaking the connection and its underlyingURLSessionWebSocketTask, and delivering duplicatenextmessages routed through the stale connection. The old connection is now closed before being replaced. Fixes #3649. - Remove unnecessary
throwsfromWebSocketTransport.init(#1039):WebSocketTransport.initwas markedthrowsbut made no throwing calls; the vestigial annotation has been removed. This is a source-breaking change for callers who usedtrywhen constructing aWebSocketTransport. Closes #3638.
Improved
- Prune the
findInXcodedirectory walk (#1015):VersionChecker.findInXcoderecursively enumerated every descendant of the project root to locatePackage.resolved, walking build artifacts,.git, vendored dependencies, and git worktrees on everygenerate/fetch-schemainvocation. The walk now skips hidden files and package descendants, reducing a ~30s walk to ~0.2s on a repo with ~150k nested files. Note: a project located inside a hidden directory is no longer discovered; this is intentional. Thank you to @dfed for the contribution.
1.25.7
Improved
- Expose
DatabaseRowstored properties forSQLiteDatabaseextensibility (#1056):DatabaseRow's stored properties (cacheKeyandstoredInfo) are nowpublic, complementing the public initializer added in #664. This lets adopters build wrapper or decorator implementations of the publicSQLiteDatabaseprotocol — for encryption, compression, logging, metrics, and similar use cases — without duplicating Apollo's SQLite implementation. This change only expands the public API surface and introduces no behavioral changes. Thank you to @ErShubhShankar for the contribution.
2.2.0
Fixed
- Xcode 27 (Swift 6.4) build compatibility (#1034): Fixed multiple build failures introduced by Swift 6.4 / Xcode 27.
AnyHashable'sSendableconformance is now explicitly unavailable in Swift 6.4, soAnyHashable as JSONValuecasts no longer compile; replaced with explicit scalar type-matching helpers (withBoolchecked beforeNSNumberto 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 singleapolloWrappertarget. FixedWebSocketConnection.send()silently discarding errors by cancelling the underlying task on failure so the transport's reconnection state machine runs correctly. Also fixed\x22escapes in composed Swift Regexes andAsyncResultObserver.handler@Sendableconformance under Swift 6.4. Thank you to the community members who submitted PRs identifying these issues. - Fix
WebSocketTransportretain cycle in receive loop (#1011): TheWebSocketTransportactor was never deallocated after a connection was established because the unstructuredTaskinstartConnectionReceiveLoop()capturedselfstrongly. The receive loop now uses[weak self]anddeinitexplicitly closes the connection so the transport deallocates correctly when all external references are dropped. Thank you to @heltoft for the contribution. - Fix crash in
SelectionSetequality for nullable-inner object lists (#986): Comparing twoSelectionSetvalues containing a[Object?](non-null list, nullable element) field where any element wasnulltriggered apreconditionFailure("Expected list data to contain objects."). Added a[DataDict?]branch inconvertElementsthat handles the mixedDataDict + NSNullcase and preserves null positions so position-sensitive equality remains correct. Thank you to @dfed for the contribution.
2.1.2
Fixed
- Make
SubscriptionStreaminitializer public (#975): TheSubscriptionStreaminitializer was inadvertently scoped topackageaccess, preventing adopters from writing custom conformances to the publicSubscriptionNetworkTransportprotocol. The initializer is nowpublic. Fixes #3637. Thank you to @ahou8 for raising the issue. - Fix
\r\nin 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
Fixed
- Fix
\r\nin 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
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.wrongTypeerror. 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
deprecatedEnumCaseswas 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
OneOfinput object enum cases not markedindirect(#954): A@oneOfinput object that directly references itself generated a Swift enum that failed to compile withRecursive enum is not marked 'indirect'. Self-referencing cases are now correctly markedindirect. Fixes #3633. Thank you to @ahou8 for raising the issue.
1.25.5
Fixed
- Fixed concurrency crash in
compileGraphQLResulton Swift 6.3/macOS 26 (#929): Serializedasync letcalls incompileGraphQLResultto work around a Swift concurrency runtime crash triggered when code generation is used in anAsyncParsableCommand. See PR #942. Thank you to @m4p for the contribution.
2.1.0
New
- WebSocket Transport: Apollo iOS 2.0 now supports WebSocket connections using the
graphql-transport-wsprotocol 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
markTypesNonisolatedcodegen option that emitsnonisolatedon all generated type declarations. This prevents compilation errors whenSWIFT_DEFAULT_ACTOR_ISOLATION = MainActoris enabled. The option defaults totruewhen the codegen tool is compiled with Swift 6.2+. - ApolloURLSession delegate injection (#899): Added support for injecting a custom
URLSessionTaskDelegateintoApolloURLSession, 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 byasync letstack management during code generation inAsyncParsableCommandcontexts. Thank you to @m4p for the contribution.
New
- WebSocket Transport: Apollo iOS 2.0 now supports WebSocket connections using the
graphql-transport-wsprotocol 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
URLSessionTaskDelegateintoApolloURLSession, enabling delegate callback handling. Thank you to @hammy-e for the contribution. - Make
JSONRequest.useGetForQueriesmutable (#897): TheuseGetForQueriesproperty onJSONRequestis now avar, 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-Nameheader to requests to satisfy Apollo Router's CSRF prevention requirements.
Improved
- Use dictionary for
objectType(forTypename:)lookup (#918): Replaced the generatedswitchstatement inSchemaMetadata.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
Improvement
- Use dictionary instead of switch for
objectType(forTypename:)lookup (#3631): The generatedSchemaMetadata.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
New
- WebSocket Transport: Apollo iOS 2.0 now supports WebSocket connections using the
graphql-transport-wsprotocol 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
URLSessionTaskDelegateintoApolloURLSession, enabling delegate callback handling. Thank you to @hammy-e for the contribution. - Make
JSONRequest.useGetForQueriesmutable (#897): TheuseGetForQueriesproperty onJSONRequestis now avar, 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-Nameheader to requests to satisfy Apollo Router's CSRF prevention requirements.
Improved
- Use dictionary for
objectType(forTypename:)lookup (#918): Replaced the generatedswitchstatement inSchemaMetadata.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.