swiftui-view-refactor
Installation
SKILL.md
SwiftUI view refactor
- Default to vanilla SwiftUI: local state in the view, shared dependencies in the environment, business logic in services or models. Add a view model only if one exists or is requested.
- Extract dedicated
Viewtypes for non-trivial sections. Keep computedsome Viewhelpers rare and small. - Keep a stable view tree. Put conditions inside sections and modifiers, not as
if/elseroot swaps. - Keep business logic out of
body,.task,.onAppear,.onChange, and.refreshable. Call small private methods. - Pass observables explicitly. Avoid
bootstrapIfNeeded-style delayed setup.