What problem does it solve?
Refactor and review SwiftUI view files for consistent structure, dependency injection, and Observation usage. Use when cleaning up a SwiftUI view’s layout and ordering, ensuring non-optional view models when possible, and standardizing how dependencies and @Observable state are initialized and passed.
Core Features & Use Cases
- Enforce a top-to-bottom view ordering: Environment, private/public let, @State, stored properties, computed vars, init, body, and helpers.
- Promote MV-patterns and lightweight views: prefer small views, inject services via @Environment, and minimize view-model usage.
- Split large views into subviews: extract large bodies or computed views into dedicated subviews to improve readability and maintainability.
- Improve state management with @Observable: keep observable objects at the root state and pass down explicitly to children.
Quick Start
Review a SwiftUI view file and refactor it to follow the prescribed ordering and MV-pattern guidance.