This is the third Beta Release of Apollo iOS 1.0. The Beta version has full feature parity with the 0.x.x releases. The API is expected to be mostly stable. Some breaking changes may occur due to user feedback prior to General Availability (GA) Release. The Beta does not have complete documentation or usage guides, which will be completed prior to GA.
This first major version will include a new code generation engine, better generated models, and many syntax and performance improvements across the entire library. The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
SchemaMetadata.swift and SchemaConfiguration.swift.SchemaConfiguration.swift. You should also delete the old generated files.apollo-ios package, run swift package --disable-sandbox apollo-initialize-codegen-config to create the codegen configuration file.swift package --disable-sandbox apollo-generate to run code generation.--disable-sandbox or --allow-writing-to-directory . arguments must be used when running the Code Generation CLI via the SPM plugin to give the plugin permission to write the generated files to the output directory configured in your codegen configuration file.This is the second Beta Release of Apollo iOS 1.0. The Beta version has full feature parity with the 0.x.x releases. The API is expected to be mostly stable. Some breaking changes may occur due to user feedback prior to General Availability (GA) Release. The Beta does not have complete documentation or usage guides, which will be completed prior to GA.
This first major version will include a new code generation engine, better generated models, and many syntax and performance improvements across the entire library. The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
CacheKeyInfo for examples and documentation.Object, Interface, and Union for each corresponding type in your schema. These are still generated by the code generation engine. This differs from the previous API which generated static types that were subclasses of Object, Interface, and Union. The change provides the API to support the future addition of dynamic types added to your schema at runtime.self, protocol, Type) as the names of fields in your operations or types in your schema would cause compilation errors in your generated code. Now, these names will be escaped with backticks to prevent compiler errors. The names __data and fragments cannot be used as field names as they conflict with Apollo's generated object APIs Using these names will result in a validation error being thrown when attempting to run the code generation engine.Fragment objects.ApolloAPI" error when using CocoaPods: The podspec was not configured to import all required source files and some import statements were unnecessary in a CocoaPods environment. A code generation configuration option was added to order to ensure generated files are generated with the correct import statements in a CocoaPods environment. When generating code for a project that includes Apollo via Cocoapods, you must set the cocoapodsCompatibleImportStatements option to true in your ApolloCodegenConfiguration. When using the Codegen CLI that is built for you during pod install the apollo-ios-cli init command will default this option to true. When building the Codegen CLI in by other method, this option will default to false.Apollo and ApolloCodegenLib targets.includes 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!This is the first Beta Release of Apollo iOS 1.0. The Beta version has full feature parity with the 0.x.x releases. The API is expected to be mostly stable. Some breaking changes may occur due to user feedback prior to General Availability (GA) Release. The Beta does not have complete documentation or usage guides, which will be completed prior to GA.
This first major version will include a new code generation engine, better generated models, and many syntax and performance improvements across the entire library. The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
queryStringLiteralFormat: Configures how the generated operations render the operation document source. Either multi-line (as defined in operation definition) or minified to a single line.schemaDocumentation: Documentation of fields and objects from your schema will now be included as in-line documentation on generated objects. This can be disabled by setting schemaDocumentation to .excluded in your codegen configuration.warningsOnDeprecatedUsage: Adds warning annotation when using fields and arguments in generated operations that are deprecated by the schema.additionalInflectionRules: Allows you to configure custom singularization rules for generated fields names.__typename field no longer generated when manually included: __typename is automatically included in all operations and fragments and has a default property on all Selection Sets. Generating the field was redundant and caused compilation errors.This is the eighth Alpha Release of Apollo iOS 1.0. This first major version will include a new code generation engine, better generated models, and many syntax and performance improvements across the entire library. The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
Equatable and Hashable Conformance to public API Models: Object's like GraphQLRequest and GraphQLError now can be compared!Float, it will automatically be converetd to a String (just like it's always done for Int).Float defined in the GraphQL spec is actually compliant with a Swift Double. Generated code will now generate Swift code with fields of type Double for GraphQL Float.SelectionSet.data to SelectionSet.__data: This is to prevent naming conflicts with GraphQL fields named data.graphql_transport_ws protocol now sends 'complete' to end subscription: The protocol implementation was previously sending the wrong message to close the connection.This is the seventh Alpha Release of Apollo iOS 1.0. This first major version will include a new code generation engine, better generated models, and many syntax and performance improvements across the entire library. The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
.graphql file with an operation or a fragment and mark it with the directive @apollo_client_ios_localCacheMutation. This will ensure the code generator generates a mutable cache mutation operation.
/// SampleLocalCacheMutation.graphql
query SampleLocalCacheMutation @apollo_client_ios_localCacheMutation {
allAnimals {
species
skinCovering
... on Bird {
wingspan
}
}
}
/// SampleLocalCacheMutationFragment.graphql
fragment SampleLocalCacheMutationFragment on Pet @apollo_client_ios_localCacheMutation {
owner {
firstName
}
}
deprecatedEnumCases: If deprecatedEnumCases is set to exclude, deprecated cases in graphql enums from your schema will not be generated and will be treated as unknown enum values.nil as it should. This fixes #2310.This is the sixth Alpha Release of Apollo iOS 1.0. This first major version will include a new code generation engine, better generated models, and many syntax and performance improvements across the entire library. The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
AnyHashable bringing with them the ability to conform to Equatable, this should make tests easier to write.GraphQLOperation was required to query any of it's properties, you can do that on the type now..embeddedInTarget was being used.Interface and Union fields and the generated package could not successfully build.This is the fifth Alpha Release of Apollo iOS 1.0. This first major version will include a new code generation engine, better generated models, and many syntax and performance improvements across the entire library. The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
config.output.testMocks.ApolloTestSupport target (as well as your generated mocks) in your unit tests to start.let mockDog = Mock<Dog>()
mock.species = "Canine"
mock.height = Mock<Height>(feet: 3, inches: 6)
// To mock an object in a generated operation:
let generatedDogMock: AnimalQuery.Data.Animal = AnimalQuery.Data.Animal.mock(from: mockDog)
// To mock an entire query:
let queryMock = Mock<Query>()
queryMock.animals = [mockDog]
let generatedSelectionSetMock: AnimalQuery.Data = AnimalQuery.Data.mock(from: queryMock)
GraphQLNullable and GraphQLEnum from the ApolloAPI target are now exported by your generated operations. This prevents you from having to import ApolloAPI everywhere that you are consuming your generated models.CacheKeyProvider now supports grouping multiple types that share key uniqueness.StaticString instead of String in generated files.@inlinable to many ApolloAPI functions consumed by generated code.This is the fourth Alpha Release of Apollo iOS 1.0. This first major version will include a new code generation engine, better generated models, and many syntax and performance improvements across the entire library. The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
__typename field is now selected by executor on all entities automatically.This is the third Alpha Release of Apollo iOS 1.0. This first major version will include a new code generation engine, better generated models, and many syntax and performance improvements across the entire library. The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
@include/@skip directives to fields, inline fragments, or fragment spreads will now generate code that respects the optionality of these conditionally included selections.@include/@skip directives.typealias each custom scalar to a String by default. These generated files can be edited to provide custom functionality for advanced custom scalars. Custom scalar template files that have been edited will not be overwritten on later code generation executions..other option for moduleType in your code generation configuration.GraphQLNullable
GraphQLNullable parameters and a default valuevar myVar: GraphQLNullable<String>
let optionalString: String?
// Before
myVar = optionalString.map { .some($0) } ?? .none
// After
myVar = optionalString ?? .none
fragments not accessible on generated SelectionSets.__typename is now added to all operation and fragment definitions.0.51.1: Fixes a bug introduced in the last version that broke APQs. #2206 - Thanks to Kyle Browning for bringing this to our attention.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.This is the second Alpha Release of Apollo iOS 1.0. This first major version will include a new code generation engine, better generated models, and many syntax and performance improvements across the entire library. The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
This is the first Alpha Release of Apollo iOS 1.0. This first major version will include a new code generation engine, better generated models, and many syntax and performance improvements across the entire library. The primary goal of Apollo iOS 1.0 is to stabilize the API of the model layer and provide a foundation for future feature additions and evolution of the library.
query AnimalQuery {
allAnimals {
species
... on Pet {
name
}
... on Cat {
furColor
}
}
In the past, the AsCat model would have fields for species, and furColor, but to access the name field, you would need to keep a reference to the AllAnimal object and call AsPet.name. This means that you couldn’t just pass the AsCat object to a UI component.
In 1.0, because we know that Cat implements the Pet interface, the name field is merged into the Cat object.
Any property that should exist based on the type of the object will be accessible. This makes consuming our generated response objects in your applications much easier. This should greatly reduce the need for view models to wrap our generated response objects.
cacheKeyForObject closure on your ApolloClient, you can implement cache key computation on individual object types with the CacheKeyProvider protocol. See Cache Key Resolution in the RFC for more information.Package.swift file. Cocoapods and Carthage support will be coming soon.While any and all feedback about the API design, structure, and usability of the library is appreciated, this Alpha version version focuses on the new generated operation models. We would love to hear about your experiences with:
Currently, only SPM is fully supported. Because the generated models can’t easily be consumed by a Cocoapods project yet, we have not included support for installation of the client with Cocoapods. This will be included in an upcoming release shortly.
.package(name: "Apollo",
url: "https://github.com/apollographql/apollo-ios.git",
from: "1.0.0-alpha.1")
Run codegen using the instructions from the Swift scripting documentation.
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!