What problem does it solve?
This Skill addresses the common challenge of maintaining clean, well-structured, and performant SwiftUI views by providing guidelines and automated refactoring for view ordering, MV patterns, dependency injection, and Observation usage.
Core Features & Use Cases
- View Structure Standardization: Enforces a consistent ordering of elements within SwiftUI views (Environment, properties, init, body, helpers).
- MV Pattern Adoption: Guides users towards Model-View patterns, favoring lightweight views and externalizing business logic.
- Dependency Management: Recommends injecting dependencies via
@Environment and initializing view models safely.
- Observation Integration: Ensures correct usage of
@State and @Observable for state management.
- Large View Splitting: Provides strategies for breaking down complex views into smaller, manageable subviews or extensions.
- Use Case: Refactor a lengthy
ContentView file that has grown unmanageable, improving its readability and maintainability by applying the recommended structure and splitting out complex sections into dedicated computed properties or subviews.
Quick Start
Refactor the current SwiftUI view file to adhere to the recommended structure and MV patterns.