{"enrichment":{"faq":[{"a":"Modern Swift supports strict concurrency mode through your Package.swift configuration. Add `.upcomingFeature(\"StrictConcurrency\")` to your target's swiftSettings, or use the `-strict-concurrency=complete` compiler flag. This enforces Sendable conformance and catches potential data races at compile time, aligning with Swift 6.2's compiler-enforced safety model.","q":"How do I enable strict concurrency checking in my Swift package?"},{"a":"Modern Swift's migration path replaces callback-based APIs with async/await syntax. Convert completion handler parameters into return values or throws, wrap legacy callbacks using withCheckedThrowingContinuation, and update call sites to use await. This eliminates callback hell and makes error handling clearer while preparing code for strict concurrency checking.","q":"What's the best way to migrate completion handlers to async await?"},{"a":"Modern Swift requires types crossing actor boundaries to conform to Sendable. Ensure all captured variables are Sendable, use value types instead of classes where possible, and mark UI-bound types with @MainActor. Avoid @unchecked Sendable unless absolutely necessary; instead, refactor to use immutable data or proper actor isolation to satisfy the compiler's safety guarantees.","q":"How can I fix Sendable errors in Modern Swift?"},{"a":"Modern Swift's actor model isolates mutable state behind a single serial executor. Define an actor type, mark properties as private, and expose them through async methods. Actors prevent concurrent access automatically\u2014the compiler enforces that only one task can modify state at a time, eliminating data races without manual locks.","q":"What is the actor pattern for managing shared mutable state?"},{"a":"Modern Swift's async/await syntax lets you write concurrent code that reads sequentially. Mark functions with async, use await at call sites, and leverage TaskGroup or async let for parallel work. This replaces DispatchQueue and completion handlers, making concurrency safer and more readable while enabling strict concurrency checking.","q":"How do I use async await in Swift 6 for concurrent operations?"},{"a":"Modern Swift requires all UI updates on the main thread. Annotate your view controller or view model class with @MainActor, or mark individual methods with @MainActor to enforce main-thread execution. The compiler prevents accidental background UI mutations, catching threading bugs early and integrating seamlessly with async/await and actor isolation.","q":"When should I use @MainActor for UI updates in Modern Swift?"}],"shadow_tags":["compile-time-safety","actor-isolation","cancellation-handling","thread-safety-patterns","legacy-modernization","concurrent-programming","sendable-constraints","ui-threading"],"summary_rewrite":"Modern Swift equips you with patterns for Swift 6.2's compiler-enforced concurrency model, replacing legacy approaches like completion handlers and DispatchQueue with async/await, actors for shared state, and Sendable constraints. Learn to enable strict concurrency checking, migrate existing code, and avoid common pitfalls like misused @unchecked Sendable and forgotten @MainActor annotations."},"files":[{"bytes":4044,"path":"plugins/swift-engineering/skills/modern-swift/SKILL.md","sha256":"2846d3fde3971c6a11d2b9363d485b6139194169d91a9fb12f4f56bfda58f79e","url":"https://skillfed.io/files/johnrogers/claude-swift-engineering/modern-swift/aef7e959/SKILL.md"}],"id":"johnrogers/claude-swift-engineering/modern-swift","links":{"html":"https://skillfed.io/johnrogers/claude-swift-engineering/modern-swift","md":"https://skillfed.io/johnrogers/claude-swift-engineering/modern-swift.md","repo":"https://github.com/johnrogers/claude-swift-engineering"},"meta":{"agents_supported":[],"first_seen":"2026-07-28","forks":20,"language":"Python","last_updated":"2026-01-18","license":"MIT","name":"modern-swift","publisher":"johnrogers","stars":223},"relations":{"similar":[{"id":"dpearson2699/swift-ios-skills/swift-concurrency"},{"id":"rshankras/claude-code-apple-skills/concurrency-patterns"},{"id":"jamesrochabrun/skills/swift-concurrency"},{"id":"rshankras/claude-code-apple-skills/concurrency"},{"id":"CharlesWiltgen/Axiom/axiom-concurrency"},{"id":"CharlesWiltgen/Axiom/axiom-audit-concurrency"},{"id":"AvdLee/Swift-Concurrency-Agent-Skill/swift-concurrency"},{"id":"sammcj/agentic-coding/swift-development"},{"id":"notque/vexjoy-agent/swift"},{"id":"Dimillian/Skills/swift-concurrency-expert"}]},"slug":{"owner":"johnrogers","repo":"claude-swift-engineering","skill":"modern-swift"},"version":"aef7e959"}
