Review, refactor, or build SwiftUI features with correct state management, modern API usage, optimal view composition, and performance-conscious patterns. Prioritize native APIs, Apple design guidance, and testable code structure. This skill focuses on facts and best practices without enforcing specific architectural patterns.
→ Read references/workflows-review.md for review methodology
references/state.md)references/view-composition.md)references/lists-collections.md)references/modern-swiftui-apis.md)references/concurrency.md)references/navigation.md)→ Read references/workflows-refactor.md for refactor methodology
references/refactor-playbooks.md)references/modern-swiftui-apis.md)references/performance.md)references/state.md)references/patterns.md)references/state.md)references/view-composition.md)references/modern-swiftui-apis.md)references/concurrency.md)references/performance.md)references/navigation.md)If intent unclear, ask: "Do you want findings only (review), or should I change the code (refactor)?"
Review Response:
Refactor Response:
WrapperUse WhenOwnership@StateInternal view state (value type or @Observable class)View owns@BindingChild needs to modify parent's stateParent owns@BindableInjected @Observable object needing bindingsInjectedletRead-only value from parentInjectedvar + .onChange()Read-only value needing reactive updatesInjected
Key rules:
@State as private (makes ownership explicit)@State for passed values (accepts initial value only)@State with @Observable classes (not @StateObject)See references/state.md for detailed guidance and tradeoffs.
DeprecatedModern AlternativeNotesforegroundColor()``foregroundStyle()Supports dynamic typecornerRadius()``.clipShape(.rect(cornerRadius:))More flexibleNavigationView``NavigationStackType-safe navigationtabItem()``Tab APIiOS 18+onTapGesture()``ButtonUnless need location/countonChange(of:) { value in }``onChange(of:) { old, new in } or onChange(of:) { }Two or zero parametersUIScreen.main.bounds``GeometryReader or layout APIsAvoid hard-coded sizes
See references/modern-swiftui-apis.md for complete migration guide.
Use this when reviewing SwiftUI code:
@State properties marked private@State or @StateObject@Binding only where child modifies parent stateNavigationStack instead of NavigationViewButton instead of onTapGesture when appropriateonChange()body simple and pure (no side effects)navigationDestination(for:) for type-safe navigation.sheet(item:) for model-based sheetsForEach uses stable identity (never .indices for dynamic data)ForEach elementForEach (prefilter and cache)AnyView in list rowsLazyVStack/ LazyHStack for large listsbody.task for automatic cancellation.task(id:) for value-dependent tasks.onAppear with async workSee reference files for detailed explanations of each item.
.task for SwiftUI async workdeveloper.apple.com/documentation/swiftui/, developer.apple.com/documentation/swift/All workflows must follow these constraints.
This skill focuses on facts and best practices from Apple's documentation:
All references in references/:
workflows-review.md - Review methodology and findings taxonomyworkflows-refactor.md - Refactor methodology and invariantsrefactor-playbooks.md - Step-by-step refactor guidesstate.md - Property wrappers and ownership patternsnavigation.md - Navigation implementation patternsview-composition.md - View structure and extractionlists-collections.md - Identity and ForEach patternsscrolling.md - Scroll handling and paginationconcurrency.md - Async work with .taskperformance.md - Optimization strategiestesting-di.md - Testing and dependency injectionpatterns.md - Common SwiftUI patternsmodern-swiftui-apis.md - Legacy API migrationcode-review-refactoring.md - Code quality checks