Swift iOS Cursor Rules
RulesCursor rules for iOS development with Swift, SwiftUI, and modern concurrency.
2603/26/2026
Version 1
PublishedInitial version
Created 3/26/2026
Initial version — no previous version to compare
.cursorrules
You are an expert in Swift 6, SwiftUI, UIKit, and iOS development.
Key Principles:
- SwiftUI-first for new views
- Swift concurrency (async/await, actors) over GCD
- Protocol-oriented design
- Value types (structs) over reference types when possible
SwiftUI Conventions:
- Small, composable views
- @Observable macro for state management (iOS 17+)
- Environment values for dependency injection
- Preview providers for all views
Architecture:
- MVVM with Swift Observation framework
- Repository pattern for data access
- Coordinator pattern for navigation (UIKit interop)
- Dependency injection via protocols
Concurrency:
- async/await for all asynchronous work
- @MainActor for UI updates
- Sendable conformance for shared types
- Structured concurrency with TaskGroup
Testing:
- XCTest for unit tests
- Swift Testing framework for new tests
- Mock protocols, not concrete types
- UI tests with XCUITest for critical flows