swift-style
Swift code style conventions for clean, readable, and idiomatic code.
- Enforces naming conventions (UpperCamelCase for types, lowerCamelCase for everything else) and prioritizes clarity over brevity
- Advocates the "golden path" pattern: early returns and guards to keep happy-path logic left-aligned, avoiding deep nesting
- Covers code organization with extensions and MARK comments, memory management with weak captures, and access control best practices
- Identifies five common mistakes: unnecessary abbreviations, nested conditionals, inconsistent self usage, vague type names, and implicit access control
Swift Style Guide
Code style conventions for clean, readable Swift code.
Core Principles
Clarity > Brevity > Consistency
Code should compile without warnings.
Naming
UpperCamelCase— Types, protocolslowerCamelCase— Everything else- Clarity at call site
- No abbreviations except universal (URL, ID)
More from johnrogers/claude-swift-engineering
ios-hig
Use when designing iOS interfaces, implementing accessibility (VoiceOver, Dynamic Type), handling dark mode, ensuring adequate touch targets, providing animation/haptic feedback, or requesting user permissions. Apple Human Interface Guidelines for iOS compliance.
202swiftui-patterns
>-
179ios-26-platform
Use when implementing iOS 26 features (Liquid Glass, new SwiftUI APIs, WebView, Chart3D), deploying iOS 26+ apps, or supporting backward compatibility with iOS 17/18.
169swift-testing
Use when writing tests with Swift Testing (@Test, #expect, #require), migrating from XCTest, implementing async tests, or parameterizing tests.
138composable-architecture
Use when building features with TCA (The Composable Architecture), structuring reducers, managing state, handling effects, navigation, or testing TCA features. Covers @Reducer, Store, Effect, TestStore, reducer composition, and TCA patterns.
136sqlite-data
Use when working with SQLiteData library (@Table, @FetchAll, @FetchOne macros) for SQLite persistence, queries, writes, migrations, or CloudKit private database sync.
123