This is the second preview release of @defer support in Apollo iOS which focuses on providing early access to using the @defer directive in your operations. During preview releases bugs can occur, if you do experience anything unexpected please report it to us.
Note: Apollo supports a very specific version of the @defer directive proposal as documented here. The @defer directive is still in the proposal stage and is not an official addition to the GraphQL specification yet. This means that Apollo iOS may not work with all servers that currently support @defer.
@defer directive then an error about duplicate directives would be thrown during code generation.We have a sample schema/server that supports @defer and can be launched using the Docker configuration.
Once you have that service launched you can configure your Apollo iOS client to target the apollo-ios and apollo-ios-codegen dependency packages using the preview-defer.2 tag. Below is an example query using @defer against the schema.
query ExampleQuery {
allProducts {
sku
id
... on Product @defer(label: "additional") {
dimensions {
size
}
variation {
id
name
}
}
}
}
Alternatively here is a sample client to demonstrate the code generation and operation execution of the @defer directive.
Caveats in this preview release
@defer.Fetched April 11, 2026