What problem does it solve?
SwiftUI views often grow into unstructured, hard-to-maintain files with mixed business logic and inconsistent property ordering. This Skill provides concrete patterns for organizing view files, extracting subviews, and applying the MVVM architecture used in the Anytype iOS codebase.
Core Features & Use Cases
- View Structure Standards: Enforces a consistent property ordering (property wrappers, public/private properties, computed properties, init, body, view builders, helpers) across SwiftUI view files.
- MVVM with @Observable: Guides ViewModel creation using the @Observable macro, @State ownership, @Bindable bindings, and Factory dependency injection via @Injected.
- View Refactoring: Splits large view bodies into computed subviews and extracted components, with ViewState enum patterns for loading/error/loaded states.
- Use Case: When a SwiftUI view file exceeds 300 lines with business logic embedded in the body, use this Skill to extract a ViewModel, reorganize properties, and split the body into composable subviews.
Quick Start
Refactor this SwiftUI view to follow the standard view ordering and extract its business logic into an @Observable ViewModel.