Docs
Launch GraphOS Studio

Apollo iOS 1.3 migration guide

From 1.2 to 1.3


This guide describes the process of migrating your code from version 1.2 to version 1.3 of . Please follow the relevant migration guides if you're on a version other than 1.2.

Though 1.3 is a minor version bump, a few critical bugs were fixed in this version that require some breaking changes during the upgrade. While we strive to make the upgrade path for minor versions seamless, these issues could not be reasonably resolved without requiring this migration.

Request Chain Interceptors

The ApolloInterceptor protocol implemented by request chain interceptors has had a minor change in this version. Any custom interceptors you use are now required to be able to identify themselves through a new property.

The RequestChain protocol has also had a minor change in this version. The proceedAsync(request:response:completion:) function has been deprecated and replaced with a function named identically except for the inclusion of the interceptor so that it can be identified. This removes the need for the request chain to maintain index positioning of the list of interceptors.

Migration Steps

In order for your custom interceptors to conform to the protocol change you can simply add the following line to your interceptor.

Interceptor identification
public var id: String = UUID().uuidString

Wherever your custom interceptors call back to the request chain you should replace the call to proceedAsync(request:response:completion:) with a call to the new function.

Resolve deprecation warning
chain.proceedAsync(
request: request,
response: response,
interceptor: self,
completion: completion
)

Reserved Keyword Type Name Suffxing

When using certain keywords as the name of a type the generated code would fail to compile, as a result we decided to enforce the same reserved keyword list already being used for a Selection Set to the following other GraphQL types:

  • Custom
  • Enum
  • Input Object
  • Interface
  • Object
  • Union

Names for these types will be checked (case insensitive) against the following reserved list:

  • Any
  • DataDict
  • DocumentType
  • Fragments
  • FragmentContainer
  • ParentType
  • Protocol
  • Schema
  • Selection
  • Self
  • String
  • Bool
  • Int
  • Float
  • Double
  • ID
  • Type
  • Error
  • _

If a reserved keyword is found it will have its type name suffixed based on the type it represents, take the following Enum example:

Enum Example
enum Type {
valueOne
valueTwo
}

This would result in a generated Swift enum that looks like this:

Generated Enum
enum Type_Enum: String, EnumType

Not all of the reserved keywords listed cause a compilation error, however we felt it best to apply suffixing to all of them. This could result in some minor breaking changes to your generated code if you are currently using any of the listed reserved keywords and will require you to update their usage to the new suffixed name.

Previous
v1.2
Next
v1.5
Edit on GitHubEditForumsDiscord

© 2024 Apollo Graph Inc.

Privacy Policy

Company