modern-swift

Migrate Swift codebases from completion handlers to async/await with actor isolation.

223|21|Updated Dec 20, 2025
One-click install
npx skills add https://github.com/johnrogers/claude-swift-engineering --skill modern-swift-johnrogers
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: modern-swift
Source: https://github.com/johnrogers/claude-swift-engineering/tree/main/plugins/swift-engineering/skills/modern-swift
Command: npx skills add https://github.com/johnrogers/claude-swift-engineering --skill modern-swift-johnrogers

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This knowledge unit helps teams adopt Swift's modern concurrency features to write safe, scalable asynchronous code, migrate from legacy completion handlers, and manage shared state with actors and Sendable constraints.

Core Features & Use Cases

  • Async/await adoption, @MainActor isolation, and actor-based state management to prevent data races.
  • Migration guidance for replacing completion handlers with async/await patterns, and patterns like TaskGroup for parallel work.
  • Practical examples and references covering concurrency fundamentals, strict mode, and modern APIs to accelerate production-grade refactoring.

Quick Start

Apply the modern Swift concurrency patterns to refactor your asynchronous codebase for safety and scalability.

Frequently Asked Questions about modern-swift

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I migrate completion handlers to async await in Swift?

Migrate completion handlers to async await in Swift by refactoring asynchronous functions to return values directly rather than via callbacks. This transition replaces nested closures with sequential code, simplifying readability and error handling using modern Swift concurrency patterns.

How does actor isolation prevent data races in Swift?

Actor isolation prevents data races in Swift by serializing access to the actor's mutable state, ensuring only one task executes code within the actor at a time. This mechanism guarantees safe concurrent access to shared state without explicit locks.

When do I need Sendable constraints for Swift concurrency?

Sendable constraints are needed when passing data across concurrency boundaries in Swift, such as dispatching work to a Task. Marking types as Sendable ensures they can be safely shared across actors without introducing data races during concurrent execution.

What is the best way to run parallel network tasks in Swift?

Run parallel network tasks in Swift using TaskGroup to concurrently execute multiple asynchronous operations. This approach manages dynamic parallel work safely, collecting results efficiently while maintaining strict concurrency safety across UI and data processing operations.

How do I enable strict concurrency in a Swift codebase?

Enable strict concurrency in a Swift codebase by activating strict concurrency checking in build settings and resolving resulting warnings. This process identifies unsafe shared mutable state, guiding the adoption of actors and Sendable constraints for safe concurrent execution.