swift-knowledge-patch
Swift changes since training cutoff (5.10–6.3) — approachable concurrency, InlineArray, @c interop, module selectors, Swift Testing updates. Load before working with Swift.
What this skill does
# Swift 5.10\u20136.3 Knowledge Patch
Claude's baseline knowledge covers Swift through 5.9. This skill provides features from 5.10 (March 2024) through 6.3 (March 2026).
## Quick Reference
### Concurrency
| Feature | Summary |
|---------|---------|
| `-default-isolation MainActor` | All code MainActor-isolated by default (per module) |
| `@concurrent` | Opt function into concurrent thread pool |
| Nonisolated async | Runs on caller's actor by default (SE-0461) |
| `Task.immediate` | Starts synchronously on caller's executor |
| `isolated deinit` | Runs deinit on actor's executor |
| `weak let` | Immutable weak ref, enables Sendable |
| `@MainActor Equatable` | Actor-isolated protocol conformances |
| `Task(name:)` | Named tasks for debugging |
```swift
// Enable approachable concurrency features per-target:
.enableUpcomingFeature("NonisolatedNonsendingByDefault")
.enableUpcomingFeature("InferIsolatedConformances")
```
See `references/concurrency.md` for full details and examples.
### Language Features
| Feature | Example |
|---------|---------|
| `InlineArray` | `var buf: InlineArray<40, Sprite>` or `[40 of Sprite]` |
| Method key paths | `strings.map(\.uppercased())` |
| Default interpolation | `"\(age, default: "Unknown")"` |
| `enumerated()` | Now conforms to `Collection` |
| Module selectors | `ModuleA::getValue()` |
| `@c` attribute | Expose Swift functions to C |
See `references/language-features.md` for syntax, limitations, and examples.
### Swift Testing
| Feature | API |
|---------|-----|
| Exit tests | `#expect(processExitsWith: .failure) { ... }` |
| Attachments | `Attachment.record("debug info")` |
| Warnings | `Issue.record("msg", severity: .warning)` |
| Cancel test | `try Test.cancel()` |
See `references/swift-testing.md` for details.
### New APIs
| API | Purpose |
|-----|---------|
| `Observations { }` | Async sequence from `@Observable` types |
| `Subprocess` | Process execution (`import Subprocess`) |
| Typed `NotificationCenter` | Type-safe notifications (no string names) |
See `references/new-apis.md` for details.
## Reference Files
| File | Contents |
|------|----------|
| `concurrency.md` | MainActor default, @concurrent, Task.immediate, isolated deinit, weak let |
| `language-features.md` | InlineArray, key paths, interpolation, module selectors, @c interop |
| `swift-testing.md` | Exit tests, attachments, warnings, test cancellation |
| `new-apis.md` | Observations, Subprocess, typed NotificationCenter |
## Critical Examples
### Approachable Concurrency (6.2)
```swift
// With -default-isolation MainActor, no annotations needed:
struct ImageCache {
static var cache: [URL: Image] = [:]
static func load(from url: URL) async throws -> Image {
if let img = cache[url] { return img }
let img = try await fetchImage(at: url) // stays on MainActor
cache[url] = img
return img
}
@concurrent // explicitly run off MainActor
static func fetchImage(at url: URL) async throws -> Image {
let (data, _) = try await URLSession.shared.data(from: url)
return decode(data)
}
}
```
### InlineArray (6.2)
```swift
var bricks: InlineArray<40, Sprite> = .init(repeating: defaultSprite)
// Shorthand:
var bricks2: [40 of Sprite] = .init(repeating: defaultSprite)
bricks[0] = specialSprite
for i in bricks.indices { print(bricks[i]) } // use indices, not for-in
```
### @c Attribute for C Interop (6.3)
```swift
@c func mySwiftFunction() { /* ... */ }
// Generated header: void mySwiftFunction(void);
@c(MyLib_doWork) func doWork() { /* ... */ }
// Generated header: void MyLib_doWork(void);
@c @implementation func existingCFunction() { /* ... */ }
// Validates against pre-existing C header declaration
```
### Module Selectors (6.3)
```swift
import ModuleA
import ModuleB
let x = ModuleA::getValue()
let y = ModuleB::getValue()
// Access Swift concurrency types without ambiguity:
let task = Swift::Task { await doWork() }
```
### Observations Async Sequence (6.2)
```swift
@Observable class Store { var items: [String] = []; var loading = false }
let store = Store()
let stream = Observations {
(items: store.items, loading: store.loading) // tracks both properties
}
for await snapshot in stream {
render(snapshot.items, snapshot.loading)
}
```
### Swift Testing: Exit Tests (6.2)
```swift
@Test func preconditionFires() async {
await #expect(processExitsWith: .failure) {
precondition(false)
}
}
```
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.