Skip to main content
rulesSource-backedReview first Safety · Privacy

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.

by jaso0n0818·added 2026-06-16·
HarnessClaude Code
Review first review before installing

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 available

About 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

Show that Swift Expert - CLAUDE.md Rules for Claude Code is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.

Listed on HeyClaude
[![Listed on HeyClaude](https://heyclau.de/badge/rules/swift-expert.svg)](https://heyclau.de/entry/rules/swift-expert)

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.

FieldSwift 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 riskReview firstReview firstReview firstReview first
Notes Safety · Privacy Safety · Privacy Safety · Privacy · Safety · Privacy ·
Categoryrulesrulesrulesrules
Sourcesource-backedsource-backedsource-backedsource-backed
Authorjaso0n0818JSONboredJSONboredJSONbored
Added2026-06-162025-09-162025-09-162025-09-16
Platforms
Claude Code
Claude Code
Claude Code
Claude Code
Source repo
Safety notes— missing— missing— missing— missing
Privacy notesRules 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
ClaimUnclaimedUnclaimedUnclaimedUnclaimed

Signals

Loading live community signals…

More like this, weekly

A short, calm digest of reviewed Claude resources. Unsubscribe any time.