What problem does it solve?
This Skill addresses the complexity and inconsistency that can arise in SwiftUI view code, ensuring cleaner, more maintainable, and performant UI components.
Core Features & Use Cases
- Code Structure Standardization: Organizes SwiftUI views according to best practices for ordering of properties and methods.
- MV Pattern Enforcement: Promotes a Model-View (MV) architecture, keeping views lightweight and delegating logic to models or services.
- ViewModel Handling: Safely manages ViewModels when they are present, preferring non-optional states and proper dependency injection.
- Observation Integration: Ensures correct usage of
@Observable and @State for reactive UI updates.
- Use Case: Refactor a large, complex
ContentView file to improve readability, split large computed properties into smaller subviews, and ensure view models are initialized correctly.
Quick Start
Refactor the attached SwiftUI view file 'UserProfileView.swift' to adhere to the MV pattern and improve its structure.