Use when adding new error messages to React, or seeing "unknown error code" warnings.
npx skills add totallyGreg/claude-mp --skill "swift-dev"
Install specific skill from multi-skill repository
# Description
Expert guidance for Swift development including SwiftUI, iOS/macOS frameworks, Server-side Swift, and Objective-C to Swift 6 migration. Use when developing Swift applications, working with Apple frameworks, building server-side Swift apps, or modernizing legacy Objective-C codebases to Swift 6. Supports Swift 5.0-6.0 with version annotations and live documentation fetching.
# SKILL.md
name: swift-dev
description: Expert guidance for Swift development including SwiftUI, iOS/macOS frameworks, Server-side Swift, and Objective-C to Swift 6 migration. Use when developing Swift applications, working with Apple frameworks, building server-side Swift apps, or modernizing legacy Objective-C codebases to Swift 6. Supports Swift 5.0-6.0 with version annotations and live documentation fetching.
metadata:
version: "1.2.0"
license: "MIT"
compatibility: ">=5.0"
Swift Development Expert
Expert guidance for modern Swift development across all Apple platforms and server-side applications. Leverage idiomatic Swift patterns, type safety, and modern concurrency for production-ready code.
Quick Start
When to use this skill:
- SwiftUI Development: Building modern declarative UIs for Apple platforms
- Language Features: Using async/await, actors, generics, and modern Swift patterns
- Frameworks: Integrating with Combine, Core Data, CloudKit, StoreKit, URLSession
- Server-Side: Building backend APIs with Vapor, Fluent ORM, Swift NIO
- Migration: Modernizing legacy Objective-C to Swift 6
Core Capabilities
1. SwiftUI Development
Declarative UI framework for all Apple platforms (iOS, macOS, watchOS, tvOS).
Key Areas:
- State Management: @State, @Binding, @StateObject, @EnvironmentObject, @Environment
- Navigation: NavigationStack, NavigationSplitView, TabView, modal presentations
- Views: Lists, Forms, Grids, ScrollView, custom modifiers
- Animations & Transitions: Interactive, spring-based, with async support
- Gestures: Tap, long-press, drag, combined gestures
- Performance: LazyVStack/LazyHStack, @ViewBuilder, EquatableView
Deep Dive: β SwiftUI Components Reference
Key Patterns:
- State management for responsive UIs: β State Management
- Navigation in iOS 16+: β Navigation Stack
- Custom view modifiers: β View Modifiers
2. Swift Language Features
Modern patterns and idioms for idiomatic, type-safe Swift code.
Core Concepts:
- Concurrency (Swift 5.5+): async/await, actors, structured concurrency, TaskGroups
- β Complete Concurrency Guide
- Protocols: Protocol-oriented programming, extensions, associated types
- β Protocol Examples
- Generics: Type parameters, constraints, conditional conformance
- β Generics Deep Dive
- Property Wrappers (Swift 5.1+): Custom attribute behavior, projectedValue
- β Property Wrapper Patterns
- Result Builders (Swift 5.4+): DSL creation for view hierarchies
- β Result Builder Guide
- Error Handling: throws, Result, async/await, typed throws (Swift 6)
- β Error Patterns
- Availability: Platform and version annotations
- β Platform Availability
Version Timeline:
- Swift 5.5: async/await, actors, structured concurrency
- Swift 5.7: Generics improvements, if let shorthand
- Swift 5.9: Macros, parameter packs, @Observable macro
- Swift 6.0: Complete concurrency checking, typed throws
β Full Swift Language Features Reference
3. iOS/macOS Frameworks
Essential Apple platform frameworks for native app development.
Framework Overview:
| Framework | Purpose | Use When |
|---|---|---|
| Combine | Reactive programming | Data binding, reactive flows |
| Core Data | Local data persistence | Structured data storage, querying |
| CloudKit | Cloud sync & sharing | Multi-device sync, collaboration |
| StoreKit 2 | In-app purchases | Monetization, subscriptions |
| URLSession | Networking | API requests, async/await |
Key Patterns:
- Core Data: @FetchRequest in SwiftUI, background contexts, relationships
-
CloudKit: Database management, subscriptions, record sharing
-
StoreKit 2: Product loading, purchase flows, transaction handling
-
URLSession: Async/await networking, error handling
-
Combine: Publishers, operators, subscribers
- β Combine Framework
β Complete iOS/macOS Frameworks Guide
4. Server-Side Swift
Backend services with Vapor, Fluent ORM, and Swift NIO.
Frameworks:
- Vapor: Web framework with routing, middleware, async/await
- REST API endpoints, middleware stack, authentication, validation
-
Fluent ORM: Type-safe database interaction
- Model definitions, relationships, migrations, querying
-
Swift NIO: Low-level async networking
- Custom protocols, EventLoopFuture, channel handlers
- β Swift NIO Guide
Databases: PostgreSQL, MongoDB, Redis, SQLite
Deployment: Docker, Kubernetes, environment configuration
β Complete Server-Side Frameworks Guide
5. Objective-C Migration
Modernize legacy Objective-C to Swift 6.
Migration Strategy (5 Phases):
- Assessment - Use
scripts/migration_analyzer.pyto identify opportunities - Foundation - Migrate models and utilities first
- Swift 6 Modernization - GCD β Task, locks β actors, KVO β @Observable
- UI Layer - Update views incrementally with MainActor
- Polish - Enable complete concurrency checking
Key Modernizations:
- Concurrency: From GCD (dispatch_async, queues) to Task-based structured concurrency
-
Data Flow: From KVO to @Observable macro, NSNotificationCenter to AsyncStream
-
Interoperability: Bridging headers, @objc exposure, nullability
- β Objective-C Interop
β Complete Migration Guide
β Bridging & Interop Patterns
Response Guidelines
Initial Assessment Questions
When helping with Swift development, clarify:
1. Target platform(s): iOS, macOS, watchOS, tvOS, server
2. Minimum Swift version: Language features depend on Swift version
3. Deployment target: iOS 15+, macOS 12+, etc.
4. Architecture: SwiftUI vs UIKit/AppKit, MVVM vs other patterns
Code Quality Standards
Follow these principles:
- Swift API Design Guidelines: Naming, parameter labels, clarity
- Access Control: private, fileprivate, internal, public appropriately
- Type Safety: Leverage Swift's type system, avoid force unwrapping
- Error Handling: Use throws, Result, or optionals appropriately
- β Error Handling Patterns
- Testability: Dependency injection, modular design
- β Design Patterns
Design Patterns
Proven architectural approaches for maintainable code:
- MVVM: Model-View-ViewModel for SwiftUI apps
-
Dependency Injection: Constructor, property, method injection
-
Repository Pattern: Abstract data access, swap implementations
-
Coordinator: Navigation and flow management
- β Coordinator Pattern
β Complete Design Patterns Guide
Testing Approach
- Unit Tests: Test business logic with XCTest
- Async Tests:
async throwstest functions - Test Doubles: Mocks, stubs, fakes for dependencies
- TDD: Test-driven development workflows
Reference Library
Complete guides organized by category:
Language & Patterns
- Swift Language Features - Protocols, generics, property wrappers, error handling, version management
- Swift Concurrency - async/await, actors, TaskGroups, async sequences, structured concurrency
- Design Patterns - MVVM, DI, Repository, Coordinator, composition patterns
Frameworks
- SwiftUI Components - Views, modifiers, navigation, animations, gestures, state management
- iOS/macOS Frameworks - Core Data, CloudKit, StoreKit 2, URLSession, framework overview
- Combine Framework - Publishers, operators, subscribers, reactive patterns
Platform-Specific
- Server-Side Frameworks - Vapor, Fluent ORM, Swift NIO, WebSockets, authentication
- Swift Package Manager - Package configuration, dependencies, multi-target projects
- Testing Strategies - XCTest, mocking, async testing, TDD approaches
Migration & Interop
- Objective-C to Swift 6 Migration - Comprehensive guide with concurrency, data flow, and pattern translations
- Objective-C Interop - Bridging headers, @objc exposure, nullability, blocks to closures
Tools & Resources
Scripts
scripts/migration_analyzer.py- Analyze Objective-C code for Swift 6 opportunities- Detects legacy concurrency patterns, KVO usage, error handling patterns
-
Provides specific migration recommendations
-
scripts/swift_package_init.py- Initialize Swift Package Manager projects - Sets up Package.swift, directory structure, git configuration
Templates
- SwiftUI app - Complete app template with MVVM architecture
- Vapor server - REST API boilerplate with database integration
- Package - Swift Package Manager library template
Accessing Official Documentation
Use WebFetch to retrieve current Swift documentation:
- Swift Language Guide - Official language reference
- Apple Frameworks - Platform framework documentation
- Vapor Docs - Server-side Swift framework
- Swift Evolution - Language proposals and changes
Use WebFetch when asking about latest API changes, feature availability, or official best practices.
Development Philosophy:
Write idiomatic Swift that leverages type safety, optionals, and protocol-oriented design. Prefer value types (struct, enum) over reference types unless reference semantics are needed. Use modern async/await concurrency, avoid legacy GCD patterns, and apply @MainActor for UI code.
# Supported AI Coding Agents
This skill is compatible with the SKILL.md standard and works with all major AI coding agents:
Learn more about the SKILL.md standard and how to use these skills with your preferred AI coding agent.