Apollo iOS
npx @buildinternet/releases get apollo-iosnpx @buildinternet/releases get apollo-iosincludes path. #2205 - Thanks to @bannzai for the contribution!graphql_transport_ws protocol could result in 4400 errors from the server: The correct protocol message is now being sent to the server to end communication. #2320print statement with CodegenLogger.log: All codegen output is logged with CodegenLogger which can be disabled if needed. #2348 - Thanks to @hiltonc for the contribution!GraphQLResultError path string: Adds a new publicly available computed property to GraphQLResultError which just exposes the path description. #2361 - Thanks to @joshuashroyer-toast for the contribution!Sendable class JavaScriptError cannot inherit from another class other than NSObject: Xcode 13.3 introduced some additional requirements for Error types and JavaScriptError did not conform causing compile errors in ApolloCodegenLib. This change disables Sendable type checking for JavaScriptError while maintaining type-safety across concurrency boundaries. #2147 - Thank you to Tiziano Coroneo for the contribution.watch(query:cachePolicy:) method of ApolloClient was .returnCacheDataDontFetch it could still trigger a remote fetch of the query. - Thank you to Peter Potrebic for raising the issue.graphql-ws Protocol Support: We've added official support for the graphql-ws library and its graphql-transport-ws protocol. This is a breaking change because the WebSocket initializers now require you to specify which protocol to use.returnResultAsyncIfNeeded is defined as optional but if not included would cause debug builds to crash with an assertionFailure in the case of a failure of the Result. #2005 - Thank you to Richard Topchii for raising this issue!CachePolicy.default is now a stored property: It is now easier to configure a different default value for the CachePolicy property on any ApolloClient instance instead of having to override it in a subclass. #1998 - Thank you to Tiziano Coroneo for the contribution!cacheKey function as public: The access modifier of this function on GraphQLField has changed from internal to public. It is not recommended to rely on internal behaviour of the cache, and this is subject to change in future major versions. #2014 - Thank you to Peter Potrebic for the discussion!ApolloSchemaDownloader: Introspection-based schema downloads can now be queried using a GET request. #2010 - Thank you to Mike Pitre for the contribution!__typename fields to inline fragments in operations to match the output from the client:push CLI command which used for operation safelisting. This should not affect the behaviour of your operations. #2028.upsert and insertMany. #2015 - Thank you to Hesham Salman for the contribution.ApolloSchemaDownloadConfiguration.HTTPHeader initializer was not public: The struct initializer that Swift automatically generates is marked with the internal access level, which meant that custom HTTP headers could not be added to an instance of ApolloSchemaDownloadConfiguration. #1962 - Thank you to Nikolai Sivertsen for the contribution!ApolloSchemaDownloadConfiguration and ApolloCodegenOptions objects using only output folders the default output filename for the schema download was different from the default schema input filename for codegen. #1968 - Thank you to Arnaud Coomans for finding this issue!WebSocketTransport initializer can be configured with a subclass of OperationMessageIdCreator to provide a unique identifier per request. The default implementation is ApolloSequencedOperationMessageIdCreator and retains the current behavior of sequential message numbering. #1919 - Thank you to Clark McNally for the contribution!start_ack message that AWS AppSync servers respond with when a subscription is requested. #1919 - Thank you to Clark McNally for the contribution!ApolloWebSocket via Cocoapods: Thank you to ketenshi for the contribution!ApolloWebSockets target instead of an external dependency on a forked version of Starscream. #1906
DefaultWebSocket implementation has been replaced with WebSocket.clearCache not using the provided callback queue: ApolloClient was not passing the provided callback queue to ApolloStore and therefore the completion block for clearCache was being called on the main queue. #1904, #1901 - Thank you to Isaac Ressler for the contribution!main and will instead become available in the release/1.0-alpha-incubating branch until a 1.0 release. #1873WebSocketTransport to be configured with a store to update the cache when receiving data. This should not break any workarounds others have already implemented. #1889, #1892 - Thank you to tgyhlsb for the contribution!ApolloWebSocketClient protocol was removed and replaced with WebSocketClient.WebSocketClient does not rely directly on Starscream anymore and has been streamlined for easier conformance.ApolloWebSocket, the default implementation of the WebSocketClient has 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.WebSocketClientDelegate replaces direct dependency on Starscream.WebSocketDelegate for delegates.LegacyInterceptorProvider -> DefaultInterceptorProviderLegacyCacheReadInterceptor -> CacheReadInterceptorLegacyCacheWriteInterceptor -> CacheWriteInterceptorLegacyParsingInterceptor -> JSONResponseParsingInterceptorWebSocketTransport is now initialized with an ApolloWebSocket (or other object conforming to the ApolloWebSocketClient protocol.) Previously, the initializer took in the necessary parameters to create the web socket internally. This provides better dependency injection capabilities and makes testing easier.ApolloInterceptor and converted to structs for all interceptors that could be structs instead of classes.removeRecords(matching pattern: CacheKey) function to the normalized cache.ApolloCore into two more granular libraries, ApolloAPI (which will contain the parts necessary to compile generated code) and ApolloUtils (which will contain code shared between Apollo and ApolloCodegenLib). If you were previously importing ApolloCore, in most places you will need to import ApolloUtils. If you're using Carthage, you will need to remove the old ApolloCore xcframework and replace it with the two ApolloAPI and ApolloUtils frameworks. (#1817)cachePolicy when calling refresh on a GraphQLWatcher. (#1802)Package.swift file since we're not using it to run tests directly at this time. This prevents SPM from trying to resolve test dependencies that are not actually used in the library, which should reduce any version conflicts. However, if you were using any of our test libs in an unsupported fashion, these will no longer be directly available. (#1745)Starscream returned multiple errors in close succession, an exponential number of web socket reconnections could be created. (#1762)class constraints to AnyObject constraints, which should silence a few warnings in 12.5 and be more forward compatible. (#1733)GraphQLWatcher. (#1723)ApolloWebSocket. (#1759)? when generating a GET URL if queryItems is empty. (#1729)default fetch policy to include fetch and watch. Note that under the hood, this does not change what fetch policy was pointed to at this time, it just centralizes the logic. (#1737)Starscream dependency to 4.0.x. Note that due to SOCKS proxy support being removed from Starscream, we've correspondeingly removed such support.(#1659)ApolloSchemaOptions to more clearly handle introspection (ie, from a URL) vs registry (ie, from Apollo Studio) requests by using an enum. If you were passing in an endpointURL previously, you need to use the .introspection enum value going forward. Also changed the name of the field to match the new type. (#1691)CoadableParsingInterceptor and related code designed for new codegen (which is still in progress) since we were wildly over-optimistic on how quickly we'd be using it. (#1670)canceling state could trigger a No data found for task assertion failure. (#1677)+ in GET requests. (#1653)GET requests removed existing query params from the URL. (#1687)cancel on a RequestChain which has already been cancelled. (#1679)UploadRequests were not getting headers added via the RequestChainNetworkTransport's additionalHeaders. Please note that if you've subclassed the RCNT, you'll need to update your overrides since we had to add a parameter. (#1644)GET requests from sending a Content-Type header, which could cause servers not configured to ignore that header when the body is empty to freak out. (#1649)2.32.1. There may be some structural changes to generated code but it should not actually break anything. Please file bugs immediately if it does. (#1618)swift-tools version to 5.3, and added a fallback version of Package.swift for 5.2. (#1584)cachePolicy to a var on HTTPRequest. This makes it possible for retries to use a different cache policy, such as when an error has occurred at the network level and you want to fall back to showing what's in the cache without retrying the network call. (#1569)singleFile code generation is a .swift file and a URL passed in for multipleFiles code generation is a folder. (#1580)retry was performed in an additionalErrorInterceptor. (#1563)apollo-tooling version to include a bugfix there. (#1554)NormalizedCache and ApolloClientProtocol protocols, so if you're implementing these yourself, you'll need to update.loadRecords(forKeys:) method on ReadTransaction. We'd recommended that you use either read or readObject with the transaction, but if you were using loadRecords, you will need to shift to those other methds.ApolloStore's load(query:resultHandler:) method now also takes an optional callback queue.true, to match existing behavior. (#1521)Atomic's value is no longer public to prevent accidental misuse. If you were using this, use the mutate method instead to ensure the thread lock works properly. (#1538)URLSessionClient when it's been invalidated to throw an error instead of crashing. If you were relying on this failing loudly before, please be aware it's going to fail a lot more quietly now. (#1489)loadRecords for the SQLite cache. (#1519)Apollo as a dynamic lib. (#1483)2.31.0. (#1510)JSONSerialization handling. (#1478)nil check while clearing the cache. (#1508)ApolloStore from ApolloClient and LegacyInterceptorProvider to prevent an issue where developers could accidentally create these objects with different caches. (#1461)GraphQLHTTPResponseError type. If you were relying on this class, please copy it out of v0.34.1. (#1437)RequestBodyCreator's default implementation to fix an issue where when default parameters were passed, the compiler would always select the default implementation even if a full alternate implementation was provided. (#1450)useGETForQueries. (#1420)0.33.0.Networking Stack, Release Candidate
RequestChainNetworkTransport subclassable and changed two methods to be open so they can be subclassed in order to facilitate using subclasses of HTTPRequest when needed. (#1405)UploadRequest class, which is now open for your subclassing funtimes. (#1405)RequestCreator to RequestBodyCreator to more accurately reflect what it's doing (particularly in light of the fact that we didn't have a Request in the old networking stack, and now we do), and renamed associated properties and parameters. (#1405)Networking Stack, Release Candidate
Added some final tweaks:
ApolloStore to take a default cache of the InMemoryNormalizedCache.ApolloStore with that default cache.InterceptorProvider to provide an error interceptor, along with a default implementation that returns nil.JSONRequest to be open so it can be subclassed.This is now at the point where if there are no further major bugs, I'd like to release this - get your bugs in ASAP! (#1399
Networking Stack, Beta 2
0.33.0 changes into the networking stack for Swift 5.3 and Xcode 12.[YourProject]/Carthage/Checkouts/apollo-ios/scripts and then run ./carthage-build-workaround.sh to actually get Carthage builds that work. (#yolo committed to main)Networking Stack, Beta 1
betas/networking-stack branch. (#1341)URLSesionClient to include cancellation of in-flight operations. (#1376)extensions dictionary property to GraphQLResult. (#1370)Adds the ability to pause and resume a WebSocket connection without dumping existing subscriptions. (#1335)
Adds an initializer to SQLiteNormalizedCache that takes a SQLite.swift DatabaseConnection to more easily allow setup of pre-configured connections. (#1330)
Addresses a retain cycle that could cause memory leaks when using multiple instances of HTTPNetworkTransport.
NOTE: If you're using URLSessionClient outside the context of HTTPNetworkTransport, make sure to call invalidate() on it when whatever is holding onto it hits deinit() to prevent leaks. (#1366)
2.30.1 to fix a long-standing issue where when generating operation IDs and their related JSON file, the correct operations + fragments would be used in generating the operation ID, but not output with the JSON file. This will slightly change the output in API.swift, but it also means we can remove a related workaround from the iOS SDK. (#1316)Cartfile which declared our dependencies, since we're now internally managing them with SPM, and newer versions of Carthage just use the SPM dependencies. Note that this can cause issues if you need to use a fork of dependencies, or if you're using an older version of Carthage. (#1311)JSONValue, which may cause problems if you've already implemented this yourself, but which should mostly just replace the need to implement it yourself. Please file issues ASAP if you run into problems here. (#1317)2.28.3 to fix an issue where linter failures would cause a silent failure exit. (#1284, #1288](https://github.com/apollographql/apollo-ios/pull/1288))apollo.extensionMethod syntax introduced in 0.28.0. (#1256)ApolloCore library. For CocoaPods and SPM users, this should be automatically picked up by your package manager. Carthage users, you will need to drag the new ApolloCore library into your project manually as you have with the other Apollo libs. (https://github.com/apollographql/apollo-ios/pull/1256)2.28.0 of the Apollo JS CLI. This includes moving a bunch of static let allocations to computed static vars to prevent memory overuse. (#1246)GraphQLGetTransformer and its methods public and made a couple more methods on MultipartFormData public. (#1273)GraphQLVariable objects which conform to JSONEncodable. (#1262)ApolloCodegen library to use object.apollo.extensionMethod syntax rather than object.apollo_extensionMethod. There's a few things that are still using apollo_ notation due to constraints around conditional conformance, but you should particularly check your swift scripts for changes around FileManager APIs. (#1183)NormalizedCache now has a method for explicitly clearing the cache synchronously, in addition to the existing method to clear it asynchronously. If you've got a custom NormalizedCache implementation, you'll need to add an implementation for this method. (#1186)URLSessionClient that were causing unexpected behavior. Turns out concurrency is hard! (#1227)URLSessionClient. (#1184)URLSessionClient. (#1175)URLSession with a delegate-based implementation called URLSessionClient.
This (finally) allows background session configurations to be used with ApolloClient, since background session configurations immediately error out if you try to use the closure-based URLSession API.
This makes a significant change to the initialization of HTTPNetworkTransport if you're using a custom URLSession: Because URLSession must have its delegate set at the point of creation, URLSessionClient is now creating the URL session. You can initialize a URLSessionClient with a URLSessionConfiguration. if before you were using:
let session = URLSession(configuration: myCustomConfiguration)
let url = URL(string: "http://localhost:8080/graphql")!
let transport = HTTPNetworkTransport(url: url,
session: session)
You will now need to use:
let client = URLSessionClient(sessionConfiguration: myCustomConfiguration)
let url = URL(string: "http://localhost:8080/graphql")!
let transport = HTTPNetworkTransport(url: url,
client: client)
If you were passing in a session you'd already set yourself up to be the delegate of to handle GraphQL requests, you'll need to subclass URLSessionClient and override any delegate methods off of URLSessionDelegate, URLSessionTaskDelegate, or URLSessionDataDelegate you need to handle. Unfortunately only one class can be a delegate at a time, and that class must be declared when the session is instantiated.
Note that if you don't need your existing delegate-based session to do any handling for things touched by Apollo, you can keep it completely separate if you'd prefer.
This does not change anything at the point of calls - everything is still closure-based in the end
Please file bugs on this ASAP if you run into problems. Thank you! (#1163)
ApolloSQLite. (#1144)