swift-lang
Installation
SKILL.md
Swift 6.2 Language Patterns
Corrective guide for Swift code generation. Swift 6.2 fundamentally changed the concurrency model — most LLM training data reflects the old model.
Critical Constraints
- ❌ DO NOT use
ObservableObject+@Publishedfor macOS 14+ / iOS 17+ → ✅ Use@Observablemacro (import Observation) - ❌ DO NOT use
@StateObject→ ✅ Use@Statewith@Observableclasses - ❌ DO NOT use
@ObservedObject→ ✅ Use@Bindablefor bindings, or just pass the object - ❌ DO NOT use
@EnvironmentObject→ ✅ Use@Environmentwith custom key - ❌ DO NOT assume async functions always hop off the actor → ✅ In Swift 6.2, async functions run on the caller's actor by default
- ❌ DO NOT use
Task.detachedto get background execution → ✅ Use@concurrentattribute on the function - ❌ DO NOT add
@Sendableto everything to silence warnings → ✅ Use default MainActor isolation mode, opt out withnonisolated - ❌ DO NOT use
DispatchQueue.main.asyncfor main thread work → ✅ Use@MainActororMainActor.run {} - ❌ DO NOT use
DispatchQueue.global().asyncfor background work → ✅ Use@concurrentfunctions withawait - ❌ DO NOT create
NavigationView→ ✅ UseNavigationSplitVieworNavigationStack