swiftui-view-refactor

swiftui-view-refactor is a skill for Claude Code, Codex from dagba/ios-mcp. It costs 65 tokens per session (1,195 once invoked), scanned A, original, MIT.

A guide to reorganizing SwiftUI view files and handling their dependencies and observable state consistently.

In plain words
What is it for?
Use it to refactor large SwiftUI views, standardize property and method order, inject shared services, and apply Swift’s Observation system correctly.
Why use it?
It helps keep views small and readable while avoiding unsafe or confusing view-model initialization and state handling.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to refactor large SwiftUI views, standardize property and method order, inject shared services, and apply Swift’s Observation system correctly.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/dagba/ios-mcp/swiftui-view-refactor
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add dagba/ios-mcp --skill swiftui-view-refactor
Clone the repo
git clone --depth 1 https://github.com/dagba/ios-mcp

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swiftui-view-refactor

README.md
[![agentmods](https://agentmods.dev/badge/skills/dagba/ios-mcp/swiftui-view-refactor/github.svg)](https://agentmods.dev/skills/dagba/ios-mcp/swiftui-view-refactor)
Your own site
<a href="https://agentmods.dev/skills/dagba/ios-mcp/swiftui-view-refactor"><img src="https://agentmods.dev/badge/skills/dagba/ios-mcp/swiftui-view-refactor/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for swiftui-view-refactor

Your own site · 80×15
<a href="https://agentmods.dev/skills/dagba/ios-mcp/swiftui-view-refactor"><img src="https://agentmods.dev/badge/skills/dagba/ios-mcp/swiftui-view-refactor.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 65 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,195 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00065 $0.01195
Opus 5.5 $0.00026 $0.00478
Sonnet 5.5 $0.00013 $0.00239
Haiku 4.5 $0.00006 $0.00120

Measured 3mo ago against content hash 8035a8af1df6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

swiftui-view-refactor scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

2 near-identical copies found in the catalogue:

skills/swiftui-view-refactor/SKILL.md · 137 lines

How it starts

The opening of the file, as written. The whole thing — 137 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SwiftUI View Refactor

Overview

Apply a consistent structure and dependency pattern to SwiftUI views, with a focus on ordering, Model-View (MV) patterns, careful view model handling, and correct Observation usage.

Core Guidelines

1) View ordering (top → bottom)

  • Environment
  • private/public let
  • @State / other stored properties
  • computed var (non-view)
  • init
  • body
  • computed view builders / other view helpers
  • helper / async functions

2) Prefer MV (Model-View) patterns

  • Default to MV: Views are lightweight state expressions; models/services own business logic.
  • Favor @State, @Environment, @Query, and task/onChange for orchestration.
  • Inject services and shared models via @Environment; keep views small and composable.
  • Split large views into subviews rather than introducing a view model.

3) Split large bodies and view properties

  • If body grows beyond a screen or has multiple logical sections, split it into smaller subviews.
  • Extract large computed view properties (var header: some View { ... }) into dedicated View types when they carry state or complex branching.
  • It's fine to keep related subviews as computed view properties in the same file; extract to a standalone View struct only when it structurally makes sense or when reuse is intended.
  • Prefer passing small inputs (data, bindings, callbacks) over reusing the entire parent view state.

Example (extracting a section):

var body: some View {
    VStack(alignment: .leading, spacing: 16) {
        HeaderSection(title: title, isPinned: isPinned)
        DetailsSection(details: details)
        ActionsSection(onSave: onSave, onCancel: onCancel)
    }
}

Example (long body → shorter body + computed views in the same file):

var body: some View {
    List {
        header
        filters
        results
        footer
    }
}

private var header: some View {
    VStack(alignment: .leading, spacing: 6) {
        Text(title).font(.title2)
        Text(subtitle).font(.subheadline)
    }
}

private var filters: some View {
    ScrollView(.horizontal, showsIndicators: false) {
        HStack {
            ForEach(filterOptions, id: \.self) { option in
                FilterChip(option: option, isSelected: option == selectedFilter)
                    .onTapGesture { selectedFilter = option }
            }
        }
    }
}

Read the full file on GitHub · 137 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 137 lines · 65 tokens per session scan A 8035a8af1df6

Subscribe to this mod's changes

swiftui-view-refactor is a skill published in the GitHub repository dagba/ios-mcp (4 stars, last pushed 10mo ago), licensed MIT. It adds 65 tokens to every session and 1,195 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

swiftui-view-refactor compared with skills from other repositories

swiftui-view-refactor next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
swiftui-view-refactordagba/ios-mcpSkill410mo agoMITA65Claude Code, Codex
wear-compose-m3android/skillsSkill11kyesterdayApache-2.0A112Claude Code
kotlin-specialistJeffallan/claude-skillsSkill13ktodayMITA86Claude Code
ink-custom-brush-builderandroid/skillsSkill11kyesterdayApache-2.0A159Claude Code
swiftui-devOrkas-AI/OrkasSkill7.7ktodayMITA3Claude Code, Codex
build-android-binarymicrosoft/power-platform-skillsSkill1.2ktodayMITA150Claude Code
compose-multiplatformericrisco/rsc-harnessSkill7093d agoMITA80Claude Code, Codex