
Swift Architecture
Pick, implement, or migrate among SwiftUI and UIKit architecture patterns (MV, MVVM, MVI, TCA, Clean, VIPER, Coordinator) for an Apple platform app.
Overview
swift-architecture is an agent skill most often used in Build (also Ship review) that helps select, implement, or migrate Apple app architecture patterns using Swift 6.3, SwiftUI, and UIKit.
Install
npx skills add https://github.com/dpearson2699/swift-ios-skills --skill swift-architectureWhat is this skill?
- Compares MV, MVVM, MVI, TCA, Clean Architecture, VIPER, and Coordinator by complexity and testability
- Scoped to Swift 6.3, SwiftUI, and UIKit with migration guidance between patterns
- Includes architecture selection matrix, common mistakes, and a review checklist
- Covers feature-level fit by team size and testing requirements—not one-size-fits-all MVVM
- Architecture selection matrix covering seven patterns: MV, MVVM, MVI, TCA, Clean Architecture, VIPER, and Coordinator
Adoption & trust: 714 installs on skills.sh; 713 GitHub stars; 3/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your iOS codebase is growing chaotic views and untestable state, and you are unsure whether MV, MVVM, TCA, or another pattern fits the feature.
Who is it for?
Solo SwiftUI builders shipping real apps who need a structured pattern decision before writing screens or untangling an existing module.
Skip if: Android-only projects, server-only Swift work, or trivial single-screen prototypes where ad-hoc MV in one file is sufficient and migration cost exceeds benefit.
When should I use this skill?
Choosing, implementing, or migrating app architecture on Apple platforms; evaluating pattern fit; or reviewing whether current structure matches feature complexity.
What do I get? / Deliverables
You leave with a justified pattern choice, implementation outline, migration steps if needed, and a review checklist aligned to your complexity and testing bar.
- Recommended architecture pattern with rationale
- Migration outline between patterns when applicable
- Completed architecture review checklist for the module or app
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Structural decisions belong at the start of feature implementation in Build, but the same skill supports later refactors and reviews. Mobile UI structure, state ownership, and navigation patterns are frontend architecture concerns on iOS, iPadOS, and related Apple targets.
Where it fits
Choose MV with @Observable for a fast-moving SwiftUI MVP versus TCA for a feature with heavy reducer tests.
Plan a Coordinator-based navigation refactor when multiple UIKit storyboard flows collide.
Run the review checklist before release to confirm architecture matches stated complexity and testability goals.
How it compares
Architecture pattern playbook for Apple clients—not a UI design system skill or a generic cross-platform Flutter guide.
Common Questions / FAQ
Who is swift-architecture for?
Indie and solo iOS developers, small teams, and agent-assisted builders working in Swift 6.3 who need defensible structure for SwiftUI or UIKit apps.
When should I use swift-architecture?
Use it in Build frontend when choosing or changing patterns; also during Ship review when auditing whether current MVVM or TCA boundaries still fit feature growth or test needs.
Is swift-architecture safe to install?
It is advisory documentation with no mandated network or shell side effects; review the Security Audits panel on this page like any third-party skill before trusting agent edits to your repo.
SKILL.md
READMESKILL.md - Swift Architecture
# Swift Architecture Select and implement the right architecture pattern for Apple platform apps built with Swift 6.3 and SwiftUI or UIKit. ## Contents - [Architecture Selection](#architecture-selection) - [MV Pattern (Model-View with @Observable)](#mv-pattern) - [MVVM](#mvvm) - [MVI (Model-View-Intent)](#mvi) - [TCA (The Composable Architecture)](#tca) - [Clean Architecture](#clean-architecture) - [Coordinator Pattern](#coordinator-pattern) - [Migration Between Patterns](#migration-between-patterns) - [Common Mistakes](#common-mistakes) - [Review Checklist](#review-checklist) ## Architecture Selection Choose based on feature complexity, team size, and testing requirements. | Pattern | Best For | Complexity | Testability | |---------|----------|-----------|-------------| | **MV** | Small-to-medium SwiftUI apps, rapid iteration | Low | Moderate | | **MVVM** | Medium apps, teams familiar with reactive patterns | Medium | High | | **MVI** | Complex state machines, predictable state flow | Medium-High | High | | **TCA** | Large apps needing composable features, strong testing | High | Very High | | **Clean Architecture** | Enterprise apps, strict separation of concerns | High | Very High | | **Coordinator** | Apps with complex navigation flows (UIKit or hybrid) | Medium | High | **Default recommendation for new SwiftUI apps:** Start with MV (Model-View with `@Observable`). Escalate to MVVM or TCA only when the feature's complexity demands it. ### Decision Framework 1. **Is the feature a simple CRUD screen?** → MV pattern 2. **Does the screen have complex business logic separate from the view?** → MVVM 3. **Do you need deterministic state transitions and side-effect management?** → MVI or TCA 4. **Is the app large with many independent feature modules?** → TCA or Clean Architecture 5. **Is navigation complex with deep linking and conditional flows?** → Add Coordinator pattern ## MV Pattern The simplest SwiftUI architecture. The view observes `@Observable` models directly. No intermediate view model layer. Docs: [@Observable](https://sosumi.ai/documentation/observation/observable()) ```swift import Observation import SwiftUI @Observable class TripStore { var trips: [Trip] = [] var isLoading = false var error: Error? private let service: TripService init(service: TripService) { self.service = service } func loadTrips() async { isLoading = true defer { isLoading = false } do { trips = try await service.fetchTrips() } catch { self.error = error } } func deleteTrip(_ trip: Trip) async throws { try await service.delete(trip) trips.removeAll { $0.id == trip.id } } } struct TripsView: View { @State private var store = TripStore(service: .live) var body: some View { List(store.trips) { trip in TripRow(trip: trip) } .task { await store.loadTrips() } } } ``` **When MV is enough:** Single-screen features, prototype/MVP, small teams, straightforward data flow. **When to upgrade:** Business logic grows complex, unit testing the view's behavior becomes difficult, multiple views need to share and transform the same state differently. ## MVVM Separates view logic into a `ViewModel` that the view observes. The view model transforms model data for display and handles user actions. ```swift @Observable class TripListView