Add SWIFT_APPROACHABLE_CONCURRENCY setting, Xcode 26 defaults note, and SendableMetatype diagnostic#40
Conversation
98abe3f to
b852023
Compare
There was a problem hiding this comment.
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_CONCURRENCYin 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.mdwith a new section explaining theSendableMetatypeerror 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. |
| static func doSomething() | ||
| } | ||
|
|
||
| func doSomethingStatic<T: P>(_ type: T.Type) { } // requires SendableMetatype |
There was a problem hiding this comment.
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.
| func doSomethingStatic<T: P>(_ type: T.Type) { } // requires SendableMetatype | |
| func doSomethingStatic<T: P & Sendable>(_ type: T.Type) { } // explicitly requires a Sendable type/metatype |
| func doSomethingStatic<T: P>(_ type: T.Type) { } // requires SendableMetatype | ||
|
|
||
| @MainActor | ||
| class C: @MainActor P { |
There was a problem hiding this comment.
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.
| class C: @MainActor P { | |
| class C { } | |
| extension C: @MainActor P { |
| 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 |
There was a problem hiding this comment.
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.
| 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 |
| > **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. |
There was a problem hiding this comment.
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.
| > **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. |
…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).
b852023 to
75ee5ba
Compare
|
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 Comment 2 — Consistency of conformance declaration style ✅ Applied (optional) Comment 3 — Fix option 1 adds a redundant conformance (compile error) ✅ Fixed @MainActor
class C: P {
nonisolated static func doSomething() { } // ✅ Non-isolated requirement on a non-isolated conformance
}This aligns with the official Comment 4 — "assume" vs. "do not guess" contradiction ✅ Fixed Validated all changes against official Swift docs ( |
Changes
This PR adds three missing items identified via analysis of Swift 6.2 / Xcode 26 documentation using Context7.
1.
SWIFT_APPROACHABLE_CONCURRENCYin project settings table (SKILL.md)Added an
Approachable Concurrencyrow 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 inPackage.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 = MainActorandSWIFT_APPROACHABLE_CONCURRENCY = YESenabled 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.
SendableMetatypediagnostic (SKILL.md+references/actors.md)Added a row to the Common Diagnostics table for the error:
This
SendableMetatypeerror appears when an actor-isolated conformance (e.g.,@MainActor) is used where aSendablemetatype is required — for example, passingMyClass.selfto a generic function. Also added aSendableMetatypesubsection inreferences/actors.mdunder "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:
nonisolated-nonsending-by-default.mdisolated-conformances.mdsendable-metatypes.mdAI 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.