Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Reviews SwiftUI code for deprecated APIs, data flow, navigation, accessibility, and performance issues.
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
SKILL.md
1---2name: swiftui-pro3description: Comprehensively reviews SwiftUI code for best practices on modern APIs, maintainability, and performance. Use when reading, writing, or reviewing SwiftUI projects.4license: MIT5metadata:6author: Paul Hudson7version: "1.1"8---910Review Swift and SwiftUI code for correctness, modern API usage, and adherence to project conventions. Report only genuine problems - do not nitpick or invent issues.1112Review process:13141. Check for deprecated API using `references/api.md`.151. Check that views, modifiers, and animations have been written optimally using `references/views.md`.161. Validate that data flow is configured correctly using `references/data.md`.171. Ensure navigation is updated and performant using `references/navigation.md`.181. Ensure the code uses designs that are accessible and compliant with Apple’s Human Interface Guidelines using `references/design.md`.191. Validate accessibility compliance including Dynamic Type, VoiceOver, and Reduce Motion using `references/accessibility.md`.201. Ensure the code is able to run efficiently using `references/performance.md`.211. Quick validation of Swift code using `references/swift.md`.221. Final code hygiene check using `references/hygiene.md`.2324If doing a partial review, load only the relevant reference files.252627## Core Instructions2829- iOS 26 exists, and is the default deployment target for new apps.30- Target Swift 6.2 or later, using modern Swift concurrency.31- As a SwiftUI developer, the user will want to avoid UIKit unless requested.32- Do not introduce third-party frameworks without asking first.33- Break different types up into different Swift files rather than placing multiple structs, classes, or enums into a single file.34- Use a consistent project structure, with folder layout determined by app features.353637## Output Format3839Organize findings by file. For each issue:40411. State the file and relevant line(s).422. Name the rule being violated (e.g., "Use `foregroundStyle()` instead of `foregroundColor()`").433. Show a brief before/after code fix.4445Skip files with no issues. End with a prioritized summary of the most impactful changes to make first.4647Example output:4849### ContentView.swift5051**Line 12: Use `foregroundStyle()` instead of `foregroundColor()`.**5253```swift54// Before55Text("Hello").foregroundColor(.red)5657// After58Text("Hello").foregroundStyle(.red)59```6061**Line 24: Icon-only button is bad for VoiceOver - add a text label.**6263```swift64// Before65Button(action: addUser) {66Image(systemName: "plus")67}6869// After70Button("Add User", systemImage: "plus", action: addUser)71```7273**Line 31: Avoid `Binding(get:set:)` in view body - use `@State` with `onChange()` instead.**7475```swift76// Before77TextField("Username", text: Binding(78get: { model.username },79set: { model.username = $0; model.save() }80))8182// After83TextField("Username", text: $model.username)84.onChange(of: model.username) {85model.save()86}87```8889### Summary90911. **Accessibility (high):** The add button on line 24 is invisible to VoiceOver.922. **Deprecated API (medium):** `foregroundColor()` on line 12 should be `foregroundStyle()`.933. **Data flow (medium):** The manual binding on line 31 is fragile and harder to maintain.9495End of example.969798## References99100- `references/accessibility.md` - Dynamic Type, VoiceOver, Reduce Motion, and other accessibility requirements.101- `references/api.md` - updating code for modern API, and the deprecated code it replaces.102- `references/design.md` - guidance for building accessible apps that meet Apple’s Human Interface Guidelines.103- `references/hygiene.md` - making code compile cleanly and be maintainable in the long term.104- `references/navigation.md` - navigation using `NavigationStack`/`NavigationSplitView`, plus alerts, confirmation dialogs, and sheets.105- `references/performance.md` - optimizing SwiftUI code for maximum performance.106- `references/data.md` - data flow, shared state, and property wrappers.107- `references/swift.md` - tips on writing modern Swift code, including using Swift Concurrency effectively.108- `references/views.md` - view structure, composition, and animation.109