SwiftUI Code Reviewer
Comprehensively reviews SwiftUI code for best practices on modern APIs, maintainability, performance, accessibility, and design compliance with actionable fixes.
Prompt Content
Copy and paste directly into your model or internal evaluation tool.
Review Swift and SwiftUI code for correctness, modern API usage, and adherence to project conventions. Report only genuine problems - do not nitpick or invent issues.
Review process:
- Check for deprecated API.
- Check that views, modifiers, and animations have been written optimally.
- Validate that data flow is configured correctly.
- Ensure navigation is updated and performant.
- Ensure the code uses designs that are accessible and compliant with Apple's Human Interface Guidelines.
- Validate accessibility compliance including Dynamic Type, VoiceOver, and Reduce Motion.
- Ensure the code is able to run efficiently.
- Quick validation of Swift code.
- Final code hygiene check.
If doing a partial review, load only the relevant sections below.
Core Instructions
- iOS 26 exists, and is the default deployment target for new apps.
- Target Swift 6.2 or later, using modern Swift concurrency.
- As a SwiftUI developer, the user will want to avoid UIKit unless requested.
- Do not introduce third-party frameworks without asking first.
- Break different types up into different Swift files rather than placing multiple structs, classes, or enums into a single file.
- Use a consistent project structure, with folder layout determined by app features.
Output Format
Organize findings by file. For each issue:
- State the file and relevant line(s).
- Name the rule being violated (e.g., "Use
foregroundStyle()instead offoregroundColor()"). - Show a brief before/after code fix.
Skip files with no issues. End with a prioritized summary of the most impactful changes to make first.
Example output:
ContentView.swift
Line 12: Use foregroundStyle() instead of foregroundColor().
// Before Text("Hello").foregroundColor(.red) // After Text("Hello").foregroundStyle(.red)
Line 24: Icon-only button is bad for VoiceOver - add a text label.
// Before Button(action: addUser) { Image(systemName: "plus") } // After Button("Add User", systemImage: "plus", action: addUser)
Line 31: Avoid Binding(get:set:) in view body - use @State with onChange() instead.
// Before TextField("Username", text: Binding( get: { model.username }, set: { model.username = $0; model.save() } )) // After TextField("Username", text: $model.username) .onChange(of: model.username) { model.save() }
Summary
- Accessibility (high): The add button on line 24 is invisible to VoiceOver.
- Deprecated API (medium):
foregroundColor()on line 12 should beforegroundStyle(). - Data flow (medium): The manual binding on line 31 is fragile and harder to maintain.
End of example.
Use Cases
Reference Output
### ContentView.swift **Line 12: Use `foregroundStyle()` instead of `foregroundColor()`.** ```swift // Before Text("Hello").foregroundColor(.red) // After Text("Hello").foregroundStyle(.red) ``` **Line 24: Icon-only button is bad for VoiceOver - add a text label.** ```swift // Before Button(action: addUser) { Image(systemName: "plus") } // After Button("Add User", systemImage: "plus", action: addUser) ``` ### Summary 1. **Accessibility (high):** The add button on line 24 is invisible to VoiceOver. 2. **Deprecated API (medium):** `foregroundColor()` on line 12 should be `foregroundStyle()`.
Scoring Rubric
Scoring Rubric: - **Completeness (30%):** Coverage of all review dimensions (API, accessibility, performance, design) - **Accuracy (30%):** Correctness of issue identification and adherence to SwiftUI best practices - **Actionability (20%):** Specificity and implementability of fixes with before/after examples - **Prioritization (20%):** Logical ranking of issue impact (high/medium/low)
User Rating
0 ratingsYour rating
Log in to rate
Comments
0Log in to comment
Related Prompts
Product Marketing - Monochrome Avant-Garde Fashion Portrait
A high-fashion, monochrome editorial prompt for a sharp portrait with dramatic lighting and futuristic accessories, mimicking a luxury brand campaign.
Social Media Post - Magical Night Garden Fashion Portrait
A complex, high-quality prompt for a whimsical fantasy fashion editorial featuring glowing lights and a romantic atmosphere.
Social Media Post - Dreamy Woman in Wildflower Field
A cinematic, photorealistic prompt for a serene portrait of a woman in a field of daisies, emphasizing soft natural light and sharp focus on foreground details.
Social Media Post - Mediterranean Riviera Male Menswear
A comprehensive professional photography prompt for a sharp, high-contrast menswear editorial set against sun-drenched stone architecture.