viewmodel

Community

Create robust stateful ViewModels for SwiftUI.

Authorvjr2005
Version1.0.0
Installs0

System Documentation

What problem does it solve?

Building and maintaining stateful ViewModels for SwiftUI apps can be verbose and error-prone. This skill provides a ready-to-use pattern to encapsulate view state, coordinate between views and use cases, and enforce testable, predictable behavior with minimal boilerplate.

Core Features & Use Cases

  • ViewState pattern for local state management with an internal, non-public state that supports idle, loading, loaded, and error states.
  • Structured ViewModel patterns for detail views (with navigation) and list views (with optional navigation and tracking), including conventions for public lifecycle methods like didAppear() and didTapOnRetryButton().
  • Protocol-based dependency injection for UseCases, NavigatorContract, and TrackerContract to promote testability and modularity, while keeping navigation and tracking concerns encapsulated within dedicated components.
  • Testing guidance and example Integrations for ensuring state transitions, navigation, and tracking behaviors are verifiable.

Quick Start

Create a new ViewModel by applying the ViewState pattern and the recommended file structure for a feature.

Dependency Matrix

Required Modules

None required

Components

Standard package

💻 Claude Code Installation

Recommended: Let Claude install automatically. Simply copy and paste the text below to Claude Code.

Please help me install this Skill:
Name: viewmodel
Download link: https://github.com/vjr2005/Challenge/archive/main.zip#viewmodel

Please download this .zip file, extract it, and install it in the .claude/skills/ directory.
View Source Repository

Agent Skills Search Helper

Install a tiny helper to your Agent, search and equip skill from 223,000+ vetted skills library on demand.