mintuz/.dotfiles/swiftui-architecture

Claude Code and agent skill by mintuz/.dotfiles

Trust tier 2
  • community
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

WHEN building SwiftUI views, managing state, setting up shared services, or making architectural decisions; NOT for UIKit or legacy patterns; provides pure SwiftUI data flow without ViewModels using @State, @Binding, @Observable, and @Environment.

Install

npx vskill@latest install mintuz/.dotfiles/swiftui-architecture

SKILL.md

Modern SwiftUI Architecture

Pure SwiftUI architecture without ViewModels. The references hold patterns, examples, and edge cases.

Scope

This skill covers SwiftUI views and their data flow.

When asked to restructure UIKit or AppKit code, say that this guidance does not cover that code and leave its internals alone. Answer at the boundary:

  • Wrap an existing view controller in UIViewControllerRepresentable to show it in SwiftUI.
  • Wrap an existing view in UIViewRepresentable only when a UIView is already separated from its controller.
  • Use UIHostingController for the opposite direction, to show a SwiftUI view inside UIKit.
  • On macOS, use NSViewControllerRepresentable, NSViewRepresentable, and NSHostingController in the same three roles.

Keep the wrapped code's state where it already lives. Pass the SwiftUI side's values into the wrapper. Send the wrapper's events back out through a callback.

Start Here

  • State management: references/state-management.md
  • Observable services: references/observable-patterns.md
  • Async work: references/async-patterns.md
  • Navigation: references/navigation-patterns.md
  • UI components: references/lists.md, references/scrollview.md, references/forms.md, references/grids.md, references/sheets.md, references/tabs.md
  • Anti-patterns: references/anti-patterns.md

Typical Flow

  1. Give every mutable value and dependency one owner and lifetime (references/state-management.md, principle-derive-from-one-owner).
  • Keep a value in @State in the view that uses it.
  • Lift it to the nearest common ancestor when sibling views read it. Pass it down as an argument or a @Binding.
  • Move it into a shared @Observable service only when it must outlive that ancestor, when it is domain state that unrelated features read, or when passing it down would thread it through views that do not use it. A value in a service takes the service's lifetime, so it stays set after the screen closes (principle-narrow-state-lifetime).
  • Retain each shared service once with @State. Inject each service separately through the environment. Mutate shared state through actions on the service.
  1. Keep views declarative; put business logic in injected services (references/observable-patterns.md, principle-keep-the-core-pure).
  2. Give every async path one owner and one lifetime (references/async-patterns.md).
  • Use .task for work that starts with the view.
  • Use .task(id:) for work that must restart when an input changes. SwiftUI cancels the running task when that identity changes and when the view disappears. Put any debounce inside the task.
  • Start no input-driven work from onChange with an unstructured Task.
  • For user-triggered work, hold the Task in @State and cancel the previous one before starting the next. State what happens to an in-flight task when the view disappears.
  • Tie each result to the input that produced it, so a superseded result never renders as the current one.
  • Check Task.isCancelled immediately before every write to view state that follows an await: a cancelled task keeps running until it checks.
  • Treat cancellation as a non-error outcome. Let a retry re-enter the same path.
  1. Wire navigation with NavigationStack and typed destinations. Follow references/navigation-patterns.md when the project already depends on the AppRouter package.
  2. Build UI with the matching component guides. Audit every decision against references/anti-patterns.md.

Finish when every value and service has one stated owner, data flows down and actions up, and every async path has explicit cancellation and terminal-state behaviour.

Security

  • Security scanPassed, 100 of 100Pattern checks on the skill's files.
  • Model reviewNot runA model review is scheduled for the next rescan.

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

Repository stars
3
7-day trend score
0

Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/mintuz/.dotfiles/swiftui-architecture/badge)](https://verified-skill.com/skills/mintuz/.dotfiles/swiftui-architecture)

Something wrong with this skill or its page? Tell us.