Add nonisolated to generated code for Swift 6.2 MainActor default isolation#925
Merged
AnthonyMDev merged 4 commits intomainfrom Mar 27, 2026
Merged
Add nonisolated to generated code for Swift 6.2 MainActor default isolation#925AnthonyMDev merged 4 commits intomainfrom
AnthonyMDev merged 4 commits intomainfrom
Conversation
✅ Deploy Preview for apollo-ios-docc canceled.
|
✅ Docs preview has no changesThe preview was not built because there were no changes. Build ID: d6c22a49163f48cfda36560c ✅ AI Style Review — No Changes DetectedNo MDX files were changed in this pull request. Review Log: View detailed log
|
On Swift 6.2, the default for markTypesNonisolated is true, which causes existing template tests to fail because they don't expect the nonisolated keyword in output. Explicitly set false in all test OutputOptions inits so existing tests maintain their expected output. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Add "markTypesNonisolated" to expected JSON in codable encode/decode tests - Add "markTypesNonisolated": true to SPM codable test JSON (default on Swift 6.2) - Change nonisolatedModifier return type from TemplateString to String to prevent empty TemplateString from stripping indentation on disabled lines - Fix nonisolated template test expectations (schemaDocumentation, atLine) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
BobaFetters
pushed a commit
that referenced
this pull request
Mar 27, 2026
BobaFetters
pushed a commit
to apollographql/apollo-ios
that referenced
this pull request
Mar 27, 2026
BobaFetters
pushed a commit
that referenced
this pull request
Mar 27, 2026
1d9fce8aa Add nonisolated to generated code for Swift 6.2 MainActor default isolation (#925) git-subtree-dir: apollo-ios git-subtree-split: 1d9fce8aa1cd2ac9bc30c161f2640942612af8b3
BobaFetters
pushed a commit
that referenced
this pull request
Mar 27, 2026
…wift 6.2 MainActor default isolation git-subtree-dir: apollo-ios git-subtree-mainline: 0b2263b git-subtree-split: 1d9fce8aa1cd2ac9bc30c161f2640942612af8b3
BobaFetters
pushed a commit
that referenced
this pull request
Mar 27, 2026
4a08171c2 Add nonisolated to generated code for Swift 6.2 MainActor default isolation (#925) git-subtree-dir: apollo-ios-codegen git-subtree-split: 4a08171c2d5c9fb5eabc6b1e8370fa481ad60184
BobaFetters
pushed a commit
that referenced
this pull request
Mar 27, 2026
…de for Swift 6.2 MainActor default isolation git-subtree-dir: apollo-ios-codegen git-subtree-mainline: 3786eb1 git-subtree-split: 4a08171c2d5c9fb5eabc6b1e8370fa481ad60184
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes apollographql/apollo-ios#3601
markTypesNonisolatedoption toApolloCodegenConfiguration.OutputOptionsthat emits thenonisolatedkeyword on all generated type declarationstruewhen the codegen tool is compiled with Swift 6.2+ (#if compiler(>=6.2)),falseotherwiseSWIFT_DEFAULT_ACTOR_ISOLATION = MainActorTemplates modified
OperationDefinitionTemplate,SelectionSetTemplate,FragmentTemplate,InputObjectTemplate,OneOfInputObjectTemplate,EnumTemplate,LocalCacheMutationDefinitionTemplate,SchemaMetadataTemplate,SchemaConfigurationTemplate,MockObjectTemplate,ObjectTemplate,InterfaceTemplate,UnionTemplateGenerated output (when enabled)
Test plan
nonisolatedis emitted when option istrueand omitted whenfalsenonisolatedannotationsSWIFT_DEFAULT_ACTOR_ISOLATION = MainActoron a test target🤖 Generated with Claude Code