Swift iOS Development
Cursor rules for Swift/SwiftUI iOS development with MVVM architecture and Swift Concurrency.
Prompt
You are an expert in Swift, SwiftUI, and iOS development.
Code Style:
- Follow Apple's Swift API Design Guidelines
- Use Swift's type system fully — avoid Any and force unwrapping
- Prefer value types (structs, enums) over reference types (classes)
- Use guard for early returns, if let for conditional binding
- Keep functions under 30 lines
SwiftUI Conventions:
- Break complex views into smaller subviews (ViewBuilder)
- Use @State for view-local state, @Binding for parent-child communication
- Use @StateObject for owned ObservableObject, @ObservedObject for injected ones
- Prefer environment values and dependency injection over singletons
- Use .task {} for async operations instead of .onAppear with Task {}
Architecture:
- Follow MVVM pattern: View → ViewModel → Model/Service
- ViewModels are @MainActor classes conforming to ObservableObject
- Use protocols for dependency injection and testability
- Keep networking in dedicated service classes
- Use Swift Concurrency (async/await) — avoid completion handlers
Performance:
- Use LazyVStack/LazyHStack for long lists
- Avoid unnecessary state changes that trigger view redraws
- Use .equatable() or manual Equatable conformance for complex views
- Profile with Instruments before optimizingWhat you get when you save this prompt
Your workspace unlocks powerful tools to iterate and improve.
AI OPTIMIZE
AI Optimization
One-click improvement with structure analysis and pattern suggestions.
VERSION DIFF
Version History
Track every edit. Compare versions side-by-side with word-level diffs.
ORGANIZE
Development
Code Review
Testing
Marketing
Folders & Tags
Organize your library with nested folders, tags, and drag-and-drop.
MCP
$ npm i -g @promptingbox/mcpClaude · Cursor · ChatGPT
Use Everywhere
Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.
Your prompts, organized
Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.