Skip to content

[Feature] Support Swift 6.2 Default Actor Isolation - MainActor #3601

@col

Description

@col

Question

Just wanted to confirm that that generated code from Apollo iOS 2.0 is not expected to support "Default Actor Isolation: MainActor" ?

I just created a brand new project and the generated code was failing with the following compile errors:

SignInMutation.graphql.swift:31:12 Main actor-isolated conformance of 'MySchema.SignInMutation.Data' to 'Hashable' cannot satisfy conformance requirement for a 'Sendable' type parameter 'Self'
SignInMutation.graphql.swift:31:12 Main actor-isolated conformance of 'MySchema.SignInMutation.Data' to 'Hashable' cannot satisfy conformance requirement for a 'Sendable' type parameter 'Self'
SignInMutation.graphql.swift:31:12 Type 'MySchema.SignInMutation.Data' does not conform to protocol 'SelectionSet'
SignInMutation.graphql.swift:31:12 Type 'MySchema.SignInMutation.Data' does not conform to protocol 'SelectionSetEntityValue'
SignInMutation.graphql.swift:52:14 Main actor-isolated conformance of 'MySchema.SignInMutation.Data.SignInWithPassword' to 'Hashable' cannot satisfy conformance requirement for a 'Sendable' type parameter 'Self'
SignInMutation.graphql.swift:52:14 Main actor-isolated conformance of 'MySchema.SignInMutation.Data.SignInWithPassword' to 'Hashable' cannot satisfy conformance requirement for a 'Sendable' type parameter 'Self'
SignInMutation.graphql.swift:52:14 Type 'MySchema.SignInMutation.Data.SignInWithPassword' does not conform to protocol 'SelectionSet'
SignInMutation.graphql.swift:52:14 Type 'MySchema.SignInMutation.Data.SignInWithPassword' does not conform to protocol 'SelectionSetEntityValue'

Changing "Default Actor Isolation" from MainActor to nonisolated fixed the issue. I couldn't find any reference to this in any of the docs. Maybe this is well understood by iOS devs but I have not done any iOS development for several years so I'm a bit out of the loop.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions