Skip to content

Add SWIFT_APPROACHABLE_CONCURRENCY setting, Xcode 26 defaults note, and SendableMetatype diagnostic#40

Open
vishalpatel1994 wants to merge 1 commit intoAvdLee:mainfrom
vishalpatel1994:fix/xcode26-approachable-concurrency-sendablemetatype
Open

Add SWIFT_APPROACHABLE_CONCURRENCY setting, Xcode 26 defaults note, and SendableMetatype diagnostic#40
vishalpatel1994 wants to merge 1 commit intoAvdLee:mainfrom
vishalpatel1994:fix/xcode26-approachable-concurrency-sendablemetatype

Conversation

@vishalpatel1994
Copy link
Copy Markdown

Changes

This PR adds three missing items identified via analysis of Swift 6.2 / Xcode 26 documentation using Context7.

1. SWIFT_APPROACHABLE_CONCURRENCY in project settings table (SKILL.md)

Added an Approachable Concurrency row to the "Project settings that change concurrency behavior" table. This Xcode build setting enables a bundle of upcoming concurrency features and is distinct from setting them individually in Package.swift. Without this entry, agents may not prompt developers to check whether it's active.

2. Xcode 26 new project defaults note (SKILL.md)

Added a callout below the settings table noting that new projects created in Xcode 26 have both SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor and SWIFT_APPROACHABLE_CONCURRENCY = YES enabled by default. Without this, agents may give incorrect migration guidance to developers who started a project in Xcode 26 and haven't explicitly set these values.

3. SendableMetatype diagnostic (SKILL.md + references/actors.md)

Added a row to the Common Diagnostics table for the error:

... cannot satisfy conformance requirement for a 'Sendable' type parameter

This SendableMetatype error appears when an actor-isolated conformance (e.g., @MainActor) is used where a Sendable metatype is required — for example, passing MyClass.self to a generic function. Also added a SendableMetatype subsection in references/actors.md under "Global Actor Isolated Conformance" with a minimal reproducer and three fix options.

Rationale

Identified via review of the Swift 6.2 / Xcode 26 official documentation:

AI Assistance

Changes generated with GitHub Copilot (Claude Sonnet 4.6) using Context7 for live Swift 6.2 documentation verification, per the recommendations in CONTRIBUTING.md.

@vishalpatel1994 vishalpatel1994 force-pushed the fix/xcode26-approachable-concurrency-sendablemetatype branch from 98abe3f to b852023 Compare April 22, 2026 10:52
@AvdLee AvdLee requested a review from Copilot April 23, 2026 11:14
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds missing Swift 6.2 / Xcode 26 concurrency migration guidance to the swift-concurrency Agent Skill, covering a new Xcode build setting, new-project defaults, and a specific SendableMetatype-related diagnostic.

Changes:

  • Document SWIFT_APPROACHABLE_CONCURRENCY in the project settings table and note Xcode 26 new-project defaults.
  • Add a new “SendableMetatype” diagnostic entry to the Common Diagnostics table.
  • Extend references/actors.md with a new section explaining the SendableMetatype error and fix strategies.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
swift-concurrency/SKILL.md Updates settings guidance and adds a new Common Diagnostics row for SendableMetatype.
swift-concurrency/references/actors.md Adds a dedicated section with a repro and fix options for SendableMetatype with isolated conformances.

Comment thread swift-concurrency/references/actors.md Outdated
static func doSomething()
}

func doSomethingStatic<T: P>(_ type: T.Type) { } // requires SendableMetatype
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The SendableMetatype repro doesn’t currently show a Sendable requirement: doSomethingStatic<T: P>(_ type: T.Type) won’t impose a Sendable-metatype constraint, so the shown diagnostic is unlikely to be triggered. Consider adding an explicit Sendable constraint (e.g., T: P & Sendable / where T: Sendable) and updating the inline comment accordingly.

Suggested change
func doSomethingStatic<T: P>(_ type: T.Type) { } // requires SendableMetatype
func doSomethingStatic<T: P & Sendable>(_ type: T.Type) { } // explicitly requires a Sendable type/metatype

Copilot uses AI. Check for mistakes.
Comment thread swift-concurrency/references/actors.md Outdated
func doSomethingStatic<T: P>(_ type: T.Type) { } // requires SendableMetatype

@MainActor
class C: @MainActor P {
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example declares an isolated conformance in the class inheritance list (class C: @MainActor P) even though earlier in this section the repo uses the extension Type: @MainActor Protocol form. For consistency (and to make the suggested “remove isolation from the conformance” fix straightforward), consider moving the @MainActor conformance to an extension and keeping the type’s @MainActor annotation separate.

Suggested change
class C: @MainActor P {
class C { }
extension C: @MainActor P {

Copilot uses AI. Check for mistakes.
Comment thread swift-concurrency/references/actors.md Outdated
Comment on lines +361 to +365
1. Remove actor isolation from the conformance if the protocol requirements don't access actor state:

```swift
extension C: P {
nonisolated static func doSomething() { } // ✅ Non-isolated conformance
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix option (1) is presented as adding extension C: P, but the example already makes C conform to P (via the isolated conformance). As written, readers can’t apply this fix without first removing/relocating the original conformance. Consider rewriting option (1) as a change to the original conformance (e.g., removing global-actor isolation on the conformance and/or marking requirements nonisolated) rather than adding a second conformance.

Suggested change
1. Remove actor isolation from the conformance if the protocol requirements don't access actor state:
```swift
extension C: P {
nonisolated static func doSomething() { } // ✅ Non-isolated conformance
1. Remove actor isolation from the original conformance if the protocol requirements don't access actor state:
```swift
@MainActor
class C: P {
nonisolated static func doSomething() { } // ✅ Non-isolated requirement on a non-isolated conformance

Copilot uses AI. Check for mistakes.
Comment thread swift-concurrency/SKILL.md Outdated
Comment on lines 26 to 28
> **Xcode 26 note**: New projects created in Xcode 26 have `SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor` and `SWIFT_APPROACHABLE_CONCURRENCY = YES` **enabled by default**. When advising on a new Xcode 26 project, assume these are active unless the developer confirms otherwise.

If any of these are unknown, ask the developer to confirm them before giving migration-sensitive guidance. Do not guess.
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The “Xcode 26 note” says to assume these settings are active unless the developer confirms otherwise, but the next paragraph says “ask the developer to confirm them… Do not guess.” These instructions conflict. Consider rephrasing the note to say the defaults are likely enabled in new Xcode 26 projects, but still prompt the developer to confirm before giving migration-sensitive guidance.

Suggested change
> **Xcode 26 note**: New projects created in Xcode 26 have `SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor` and `SWIFT_APPROACHABLE_CONCURRENCY = YES` **enabled by default**. When advising on a new Xcode 26 project, assume these are active unless the developer confirms otherwise.
If any of these are unknown, ask the developer to confirm them before giving migration-sensitive guidance. Do not guess.
> **Xcode 26 note**: New projects created in Xcode 26 will often start with `SWIFT_DEFAULT_ACTOR_ISOLATION = MainActor` and `SWIFT_APPROACHABLE_CONCURRENCY = YES` enabled by default. Treat these as likely defaults for newly created projects, not as confirmed settings.
If any of these are unknown, ask the developer to confirm them before giving migration-sensitive guidance. Do not guess, even for new Xcode 26 projects.

Copilot uses AI. Check for mistakes.
…bleMetatype diagnostic

- Add `Approachable Concurrency` row to project settings table in SKILL.md
- Add Xcode 26 note: new projects have SWIFT_DEFAULT_ACTOR_ISOLATION=MainActor and
  SWIFT_APPROACHABLE_CONCURRENCY=YES enabled by default
- Add `SendableMetatype` row to Common Diagnostics table in SKILL.md
- Add `SendableMetatype` subsection in references/actors.md under
  Global Actor Isolated Conformance, with code example and 3 fix options

Identified via analysis of Swift 6.2 / Xcode 26 documentation (Context7).
@vishalpatel1994 vishalpatel1994 force-pushed the fix/xcode26-approachable-concurrency-sendablemetatype branch from b852023 to 75ee5ba Compare April 24, 2026 05:09
@vishalpatel-simformsolutions
Copy link
Copy Markdown

Thanks for the thorough review, @copilot-pull-request-reviewer! All 3 valid comments have been addressed and the commit has been amended. Here's a summary of what was fixed:

Comment 1 — Missing SendableMetatype constraint on repro function ✅ Fixed
Changed doSomethingStatic<T: P> to doSomethingStatic<T: P & SendableMetatype> so the diagnostic is actually triggered. Also updated the repro to use the extension-based conformance form (extension C: @MainActor P) per comment 2's consistency suggestion.

Comment 2 — Consistency of conformance declaration style ✅ Applied (optional)
Separated the class and its conformance into class C { } + extension C: @MainActor P { ... } to match the pattern used earlier in actors.md.

Comment 3 — Fix option 1 adds a redundant conformance (compile error) ✅ Fixed
Rewrote fix option 1 to modify the original conformance instead of adding a second extension C: P. The fix now shows removing @MainActor from the conformance and marking the static requirement nonisolated:

@MainActor
class C: P {
    nonisolated static func doSomething() { }  // ✅ Non-isolated requirement on a non-isolated conformance
}

This aligns with the official isolated-conformances.md guidance: "make the conformance itself nonisolated."

Comment 4 — "assume" vs. "do not guess" contradiction ✅ Fixed
Replaced "assume these are active" with "treat these as likely defaults for newly created projects, not as confirmed settings" and appended "Do not guess, even for new Xcode 26 projects." to the follow-on line to make the guidance consistent.

Validated all changes against official Swift docs (sendable-metatypes.md, isolated-conformances.md) and the Approachable Concurrency guide via Context7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants