Swift Expert - CLAUDE.md Rules for Claude Code
Transform Claude into a Swift specialist with deep knowledge of value semantics, protocols, async/await, SwiftUI patterns, and Apple platform API design.
Open the source and read safety notes before installing.
Privacy notes
- Rules reference API keys, signing certificates, and Keychain secrets; store them in Keychain or Xcode build settings, never in committed source files.
Schema details
- Install type
- copy
- Reading time
- 4 min
- Difficulty score
- 85
- Troubleshooting
- Yes
- Breaking changes
- No
Full copyable content
You are an expert Swift developer with deep knowledge of value semantics,
protocol-oriented design, structured concurrency, and idiomatic Apple platform
APIs.
## Core Philosophy
- Prefer value types (`struct`, `enum`) for models; use `class` when reference
semantics or Objective-C interop require it
- Design with protocols for abstraction; keep concrete types small and focused
- Use `async`/`await` and actors for concurrency; avoid callback pyramids
- Make invalid states unrepresentable with enums and failable initializers
## Types & Optionals
```swift
enum OrderStatus: Equatable {
case pending
case paid(at: Date)
case shipped(tracking: String)
}
struct Order: Identifiable {
let id: UUID
var status: OrderStatus
}
```
- Use `guard let` / `if let` for early exits; avoid force-unwrap in production
- Prefer `Result` or typed errors at boundaries instead of optional error tuples
- Keep models `Sendable` when shared across concurrency domains
## Protocols & API Design
- Define narrow protocols for dependencies; inject via initializers
- Use protocol extensions for shared default behavior
- Mark UI-facing models `Identifiable`, `Hashable`, and `Codable` only when needed
- Keep public APIs minimal; use `internal` by default
## Concurrency
- Run UI updates on `@MainActor`; isolate mutable shared state in actors
- Use `Task` with cancellation checks for long-running work
- Prefer `AsyncSequence` for streaming data; handle backpressure explicitly
- Avoid blocking the main thread; use `await` for I/O and network calls
## SwiftUI Patterns
- Keep views thin; move logic to observable models (`@Observable`, view models)
- Pass dependencies down the environment only for truly global services
- Use explicit navigation state; avoid hidden side effects in `body`
- Preview with representative mock data and dependency stubs
## Testing
- Unit test pure logic without UIKit/SwiftUI where possible
- Use protocol-based fakes for networking and persistence
- Test async code with structured tasks and deterministic clocks when availableAbout this resource
Usage
Add this rule set to your project's CLAUDE.md to configure Claude as a Swift expert.
It covers value types, protocols, async/await, error handling, and SwiftUI architecture —
grounded in The Swift Programming Language
and SwiftUI documentation.
Sources
Source citations
Add this badge to your README
How it compares
Swift Expert - CLAUDE.md Rules for Claude Code side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
| Field | Swift Expert - CLAUDE.md Rules for Claude Code Transform Claude into a Swift specialist with deep knowledge of value semantics, protocols, async/await, SwiftUI patterns, and Apple platform API design. Open dossier | iOS & Apple Platform Architecture Reviewer - CLAUDE.md Rules iOS and Apple-platform architecture reviewer covering SwiftUI state, Swift concurrency isolation, app lifecycle, and App Store review and privacy requirements — grounded in Apple's developer documentation Open dossier | Go Golang Expert - CLAUDE.md Rules for Claude Code Transform Claude into a Go language expert with deep knowledge of concurrency, performance optimization, and idiomatic Go Open dossier | Mobile App Dev - CLAUDE.md Rules for Claude Code Expert in iOS, Android, and cross-platform mobile development with React Native, Flutter, and native frameworks Open dossier |
|---|---|---|---|---|
| Trust | ||||
| Install risk | Review first | Review first | Review first | Review first |
| Notes | Safety · Privacy ✓ | Safety · Privacy ✓ | Safety · Privacy · | Safety · Privacy · |
| Category | rules | rules | rules | rules |
| Source | source-backed | source-backed | source-backed | source-backed |
| Author | jaso0n0818 | JSONbored | JSONbored | JSONbored |
| Added | 2026-06-16 | 2025-09-16 | 2025-09-16 | 2025-09-16 |
| Platforms | Claude Code | Claude Code | Claude Code | Claude Code |
| Source repo | — | — | — | — |
| Safety notes | — missing | — missing | — missing | — missing |
| Privacy notes | ✓Rules reference API keys, signing certificates, and Keychain secrets; store them in Keychain or Xcode build settings, never in committed source files. | ✓This rule reviews iOS app architecture in your local project and checks that permission usage, privacy manifests, and App Tracking Transparency are handled correctly. It does not itself collect or transmit any data. | — missing | — missing |
| Prerequisites | — none listed | — none listed | — none listed | — none listed |
| Install | — | — | — | — |
| Config | — | — | — | — |
| Citations | ||||
| Claim | Unclaimed | Unclaimed | Unclaimed | Unclaimed |
Signals
Loading live community signals…
A short, calm digest of reviewed Claude resources. Unsubscribe any time.