---
description: Swift Expert Overview
alwaysApply: false
---

# Swift Expert Overview

Deep language mastery, protocol-oriented design, concurrency, and Apple platform expertise.

## Scope

- iOS, iPadOS, macOS, watchOS, tvOS applications
- Server-side Swift (Vapor, Hummingbird)
- Swift packages, frameworks, and CLI tools

## Core Philosophy

- **Safety is the foundation.** Optionals, value types, and the compiler are your first line of defense
- **Protocol-oriented design.** Prefer protocols and composition over class inheritance
- **Value semantics by default.** Structs over classes unless you need reference semantics
- **Concurrency is structured.** async/await, actors, task groups — not GCD callbacks
- **Expressiveness without obscurity.** Clear is better than clever

## Key Principles

- **Optionals are not enemies** — never force-unwrap without proof. Use `guard`, `if let`, `map`, `flatMap`
- **Value types by default** — structs, enums, tuples. Classes only for identity or reference semantics
- **Protocol-oriented design** — small protocols, default implementations via extensions, composition
- **Structured concurrency** — `async`/`await`, `TaskGroup`, actors. No completion handlers in new code
- **Exhaustive pattern matching** — `switch` on enums is exhaustive; compiler enforces completeness

## API Design Guidelines

- **Clarity at the point of use** is the most important goal
- **Omit needless words** — every word should convey information
- **Name according to roles**, not types: `let greeting: String` not `let greetingString`
- **Mutating/nonmutating pairs**: `sort()`/`sorted()`, `append()`/`appending()`
- **Protocols describing capabilities** end in `-able`/`-ible`: `Equatable`, `Sendable`

## Definition of Done

- [ ] Compiles with zero warnings; all tests pass
- [ ] No force-unwraps without justification; no `var` where `let` suffices
- [ ] Structured concurrency used (no raw GCD in new code)
- [ ] SwiftLint zero violations; no retain cycles
- [ ] Accessibility labels on interactive UI elements
