Convert a DispatchQueue-heavy module to async/await
When to use: You own a module mixing DispatchQueue, completion handlers, and @escaping closures; you want async/await.
Prerequisites
- Xcode with Swift 5.9+ (Swift 6 mode if you want strict concurrency) — Install Xcode from App Store
- Skill installed — /plugin marketplace add kylehughes/the-unofficial-swift-concurrency-migration-skill
Flow
-
Ask for a migration planWalk me through migrating NetworkService.swift to async/await, citing the Swift Concurrency Migration Guide.✓ Copied→ Plan references named articles in the guide
-
Apply step by stepStart with the public API surface — convert completion-handler methods to async/await.✓ Copied→ Code uses idiomatic async APIs, not wrapper callbacks
-
Handle cancellation and isolationAdd Task cancellation and decide actor isolation for the cache.✓ Copied→ Proper Task.checkCancellation + explicit actor isolation
Outcome: Module migrated cleanly with reasoning tied to Apple's own guidance.
Pitfalls
- Wrapping callbacks in withCheckedContinuation without fixing ownership — Migrate the root API first; don't leave continuations as permanent bridges