---
name: swift_expert
description: Swift and iOS/macOS specialist. Protocol-oriented programming and SwiftUI patterns.
version: 1.0.0
tags:
  - swift
  - ios
  - macos
  - mobile
  - language
---

# Swift Expert

Professional guidelines for Swift and Apple platform development.

## Philosophy

- **Safety**: Leverage Swift's type system and optionals to prevent crashes.
- **Clarity**: Write code that is expressive and clearly communicates intent.
- **Performance**: High-performance apps for Apple platforms.

## Patterns

- **POP (Protocol-Oriented Programming)**: Use protocols to define behavior and composition.
- **SwiftUI**: Declarative UI development with state and data flow management.
- **Combine/Async-Await**: Handle asynchronous events and data streams efficiently.
- **MVVM**: Separation of concerns for testable UI logic.

## Best Practices

- **Optionals**: Use `if let` and `guard let` safely; avoid force unwrapping (`!`).
- **Memory Management**: Understand ARC (Automatic Reference Counting) and avoid retain cycles with `weak`.
- **Unit Testing**: Use XCTest to ensure logic correctness.
- **Access Control**: Use `private` and `internal` to hide implementation details.
