arch-mvvm-swiftuilisted
Install: claude install-skill kbelasheuski/ios-architecture-skills
# MVVM (SwiftUI, `@Observable`)
**Source references (study after reading this skill):**
- Apple Scrumdinger sample — https://developer.apple.com/tutorials/app-dev-training/getting-started-with-scrumdinger
- Apple Backyard Birds sample — https://developer.apple.com/documentation/swiftui/backyard-birds-sample
- Antoine van der Lee, *MVVM in SwiftUI* — https://www.avanderlee.com/swiftui/mvvm-architectural-coding-pattern-to-structure-views/
- Sarunw, *Observation Framework in iOS 17* — https://sarunw.com/posts/observation-framework-in-ios17/
## When to use
- SwiftUI on iOS 17+.
- Medium project, 20–80 screens.
- Per-property invalidation needed (perf-sensitive lists, charts).
## Folder structure
```
App/AppEntry.swift
Features/
UserList/
UserListView.swift
UserListModel.swift
UserDetail/
UserDetailView.swift
UserDetailModel.swift
Domain/User.swift
Domain/UserRepository.swift
Data/LiveUserRepository.swift
```
## Reference implementation
The full worked `UserList + UserDetail` feature lives in
**`examples/mvvm-swiftui/`** — `@Observable @MainActor` models, SwiftUI Views,
the app entry point, and model XCTest. `Domain` + `Data` + test fakes follow
`skills/REFERENCE_FEATURE.md` (vendored per example). Key things to
notice:
- **The model is `@Observable @MainActor`**, owned by the View via `@State` and injected into child views as a plain property — no `ObservableObject`/`@Published`.
- **Paging, refresh, and error state live in the model**, exposed as `pri