Architecture and DI standards for building scalable iOS applications with SwiftUI.
Install
mkdir -p .claude/skills/ios && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/18723" && unzip -o skill.zip -d .claude/skills/ios && rm skill.zipInstalls to .claude/skills/ios
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Architecture, SwiftUI, View architecture, and DI rules for iOS apps.Key capabilities
- →Implement Model-View-Intent (MVI) and UDF patterns in SwiftUI
- →Structure SwiftUI views with `<Name>Screen` and `<Name>View` separation
- →Minimize business logic within SwiftUI `View` structs
- →Apply Swift 6 Concurrency patterns in UI
- →Manage state using the `@Observable` macro
How it works
The skill defines architectural patterns like MVI/UDF, view structuring, and state management using `@Observable` for SwiftUI applications, emphasizing separation of concerns.
Inputs & outputs
When to use ios
- →Implement MVI architecture
- →Structure SwiftUI view hierarchies
- →Apply Swift 6 concurrency patterns
- →Set up view models
About this skill
iOS & SwiftUI Architecture Standards
Use this skill for iOS work built with SwiftUI, Swift Concurrency, and unidirectional state flow.
1. SwiftUI UI Rules
- Model-View-Intent (MVI) & UDF:
- Model: Expose single, immutable State properties from your ViewModel (or Reducer if using TCA).
- View: A pure function rendering the Model. State flows down.
- Intent: User actions are submitted to the ViewModel as explicit Intents/Events (e.g., via a
func send(_ event: Event)pattern). Events flow up.
- Screen vs View Approach:
<Name>Screenor<Name>Coordinator: Handles Environment injection, Navigation, and connects theViewModel(or Reducer) to the UI.<Name>View: A completely pure, stateless (or strictly internal view-state) SwiftUIViewthat accepts data via inputs and emits events via closures.
- Minimize Logic in Views:
- Do NOT put complex business validation or network requests in
.taskor.onAppearinside theViewstruct. - All business logic belongs in the injected
@ObservableViewModel or TCA Reducer.
- Do NOT put complex business validation or network requests in
- Swift 6 Concurrency in UI:
- SwiftUI
Viewstructs must be implicitly or explicitly@MainActorisolated. - Never use unstructured
Task { }without understanding the actor context; use.task { }modifiers tied to view lifecycle.
- SwiftUI
- Visibility & Previews:
- Keep helper Views
privateorfileprivateif they are only used within a single screen. - Provide
#Previewblocks for every distinct state of theView(loading, error, success).
- Keep helper Views
- Component Granularity:
- Minimize nesting. Extract deep view hierarchies into smaller computed properties returning
some Viewor separateViewstructs.
- Minimize nesting. Extract deep view hierarchies into smaller computed properties returning
2. State Management & Navigation
- Logic + State Separation:
- Public functions inside a ViewModel MUST represent user intents/events and generally return
Void. - Any function computing values internally should be
private. - State is exposed as published/observable properties.
- Public functions inside a ViewModel MUST represent user intents/events and generally return
- Observation:
- Use the
@Observablemacro exclusively. Do NOT use legacyObservableObject,@Published, orCombinebindings for State management unless interacting with legacy code.
- Use the
3. Dependency Injection
- Inject dependencies into ViewModels/UseCases via
init. - Use the SwiftUI
Environment(@Environment) ONLY for UI-specific dependencies (like formatters, themes, or global view routers), NOT for Repositories or UseCases.
When not to use it
- →When putting complex business validation in `.task` or `.onAppear`
- →When using unstructured `Task { }` without actor context
- →When using legacy `ObservableObject` or `@Published` for state management
Limitations
- →Requires `@MainActor` isolation for SwiftUI `View` structs
- →Requires business logic to be in ViewModel or Reducer
- →Requires `@Observable` macro for state management
How it compares
This skill enforces a specific, opinionated architecture for SwiftUI apps using MVI/UDF and `@Observable`, promoting pure views and explicit intents, unlike ad-hoc SwiftUI development.
Compared to similar skills
ios side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| ios (this skill) | 0 | 4mo | No flags | Advanced |
| swiftui-expert-skill | 13 | 3mo | No flags | Intermediate |
| swiftui-ui-patterns | 1 | 4mo | No flags | Intermediate |
| ios-navigation | 2 | 3mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
More by ABIvan-Tech
View all by ABIvan-Tech →You might also like
swiftui-expert-skill
sickn33
Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, modern APIs, Swift concurrency, and iOS 26+ Liquid Glass adoption. Use when building new SwiftUI features, refactoring existing views, reviewing code quality, or adopting modern SwiftUI patterns.
swiftui-ui-patterns
Dimillian
Best practices and example-driven guidance for building SwiftUI views and components. Use when creating or refactoring SwiftUI UI, designing tab architecture with TabView, composing screens, or needing component-specific patterns and examples.
ios-navigation
HoangNguyen0403
SwiftUI navigation and deep linking using NavigationStack and Universal Links.
view
andrelucassvt
Cria uma nova View SwiftUI seguindo o padrao MVVM do projeto (iOS 15+). Use quando o usuario pedir para criar uma nova tela, view ou screen.
macos-menubar-tuist-app
HCMUTE-RTIC
Build, refactor, or review macOS menubar apps that use Tuist and SwiftUI. Use when creating or maintaining LSUIElement menubar utilities, defining Tuist targets/manifests, implementing model-client-store-view architecture, adding script-based launch flows, or validating reliable local build/run beha
swiftui-whats-new-27
CamilleScholtz
New SwiftUI APIs, behaviors, and deprecations introduced in the 2027 OS releases (iOS 27, macOS 27, watchOS 27, tvOS 27, visionOS 27). Use when a SwiftUI view using @State fails to compile with \"used before being initialized\", \"invalid redeclaration of synthesized property\", or \"extraneous argu