SwiftUI iOS App taste — Claude and Claude.ai prompt: senior iOS rules
A set of rules for SwiftUI work: how to build screens, where state lives and which APIs to drop. Useful when an agent writes fresh iOS code.
Open on GitHubWhat SwiftUI iOS App taste does
The prompt puts the agent in the seat of a senior iOS developer. New screens go in SwiftUI, and UIKit is reached only through UIViewRepresentable when SwiftUI has no ready component for the job. Views stay small: once a body passes about 50 lines, part of it moves into a subview.
State is owned with @State at the lowest view that needs it, and bindings travel down instead of global singletons. View models on iOS 17+ use @Observable from the Observation framework, not ObservableObject with @Published. Async work means Swift Concurrency only — async/await, actors, structured tasks; no new completion-handler or Combine APIs. Kick it off with the .task modifier so it cancels when the view disappears.
Navigation runs on NavigationStack with a typed path behind a small coordinator. Loading is modelled as an enum (idle, loading, loaded, failed) rather than a pile of booleans. Some rules are hard: never block the main thread with networking, decoding or disk I/O, and keep tokens in the Keychain rather than UserDefaults or the bundle. Strict concurrency checking in Swift 6 language mode means Sendable warnings get fixed early, or the build turns noisy fast.
What it helps with
- build a new SwiftUI screen without one giant body
- move a view model from ObservableObject to @Observable
- start async loading that cancels when the screen goes away
- model loading as one enum instead of several booleans
- split a feature into local Swift packages instead of CocoaPods
Example prompts for the agent
- Build a profile screen in SwiftUI: state in @State at the lowest view, loading started with .task
- Rewrite this view model with @Observable for iOS 17+ and drop @Published
- Break this body into subviews and add a #Preview with empty, loaded and failed states
How to install SwiftUI iOS App taste
How to use
Paste the text at the start of a chat or into project instructions
Manually: put the files in place
.claude/commands/prompts.csv.mdQuestions about SwiftUI iOS App taste
How do I install SwiftUI iOS App taste in Claude?
There is no install command: paste the prompt into the chat or put it in the system instructions. For Claude the repository ships .claude/commands/prompts.csv.md.
What does SwiftUI iOS App taste do?
It gives the agent senior iOS rules: SwiftUI for new screens, Observation for view models, Swift Concurrency over completion handlers, Keychain for secrets.
Does it help on a UIKit project?
The rules target SwiftUI code and iOS 17+ for @Observable. On a project without SwiftUI only the concurrency, Keychain and logging parts still apply.
Source text
prompts.csv · CC0-1.0
# SwiftUI iOS App taste of a senior iOS developer - Build new screens in SwiftUI and drop to UIKit only through UIViewRepresentable for gaps. Confidence: 0.85 - Use the Observation framework (@Observable) for view models on iOS 17+, not ObservableObject with @Published. Confidence: 0.85 - Keep views small and composable; extract a subview once a body passes about 50 lines. Confidence: 0.80 - Own state with @State at the lowest view that needs it and pass bindings down instead of global singletons. Confidence: 0.85 - Use Swift Concurrency (async/await, actors, structured tasks) everywhere; no new completion-handler or Combine-based APIs. Confidence: 0.85 - Start async work with the .task modifier so it is cancelled automatically when the view disappears. Confidence: 0.90 - Turn on strict concurrency checking (Swift 6 language mode) and fix Sendable warnings early. Confidence: 0.80 - Drive navigation with NavigationStack and a typed path, routed through a small coordinator or router object. Confidence: 0.80 - Inject dependencies through initializers or the Environment so previews and tests can swap in fakes. Confidence: 0.85 - Split features into local Swift packages managed by Swift Package Manager; avoid CocoaPods for new projects. Confidence: 0.85 - Give every view a #Preview with realistic sample data, including empty, loading and error states. Confidence: 0.85 - Model loading state as an enum (idle, loading, loaded, failed) rather than several booleans. Confidence: 0.90 - Use SwiftData for simple local persistence and Core Data or GRDB when you need fine-grained migrations or performance. Confidence: 0.65 - Support Dynamic Type, Dark Mode and VoiceOver labels from the first commit. Confidence: 0.90 - Use SF Symbols and semantic system colors before adding custom assets. Confidence: 0.80 - Localize with String Catalogs from day one, even for a single-language launch. Confidence: 0.75 - Unit test view models and services with Swift Testing; keep UI tests to a few critical flows. Confidence: 0.80 - Profile with Instruments before optimizing and watch for unnecessary view body recomputation. Confidence: 0.75 - Never block the main thread with networking, decoding or disk I/O. Confidence: 0.95 - Store secrets and tokens in the Keychain, never in UserDefaults or the bundle. Confidence: 0.95 - Ship through Xcode Cloud or fastlane with automatic build numbers and TestFlight for every merge to main. Confidence: 0.75 - Use a structured Logger (os.Logger) with categories instead of print statements. Confidence: 0.85
© f · CC0-1.0 · f/prompts.chat