totallyGreg

swift-dev

0
0
# Install this skill:
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:

β†’ 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
  • β†’ Vapor Framework Guide

  • Fluent ORM: Type-safe database interaction

  • Model definitions, relationships, migrations, querying
  • β†’ Fluent ORM Reference

  • 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):

  1. Assessment - Use scripts/migration_analyzer.py to identify opportunities
  2. Foundation - Migrate models and utilities first
  3. Swift 6 Modernization - GCD β†’ Task, locks β†’ actors, KVO β†’ @Observable
  4. UI Layer - Update views incrementally with MainActor
  5. Polish - Enable complete concurrency checking

Key Modernizations:

β†’ 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:

β†’ Complete Design Patterns Guide

Testing Approach

  • Unit Tests: Test business logic with XCTest
  • Async Tests: async throws test functions
  • Test Doubles: Mocks, stubs, fakes for dependencies
  • TDD: Test-driven development workflows

β†’ Testing Strategies


Reference Library

Complete guides organized by category:

Language & Patterns

Frameworks

Platform-Specific

Migration & Interop


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:

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.