swiftui-patterns

swiftui-patterns is a skill for Claude Code, Codex from majiang213/OpenClaw-MAS. It costs 34 tokens per session (1,565 once invoked), scanned A, a copy of swiftui-patterns, MIT.

A guide to building Apple interfaces with SwiftUI, including view structure, app state, navigation, data flow, and rendering performance.

In plain words
What is it for?
Use it to build and organize iPhone, iPad, macOS, and other Apple-platform interfaces with SwiftUI.
Why use it?
It helps you choose suitable SwiftUI patterns as an app grows, especially when views share data or navigation becomes complex.

Skill for Claude CodeCodex

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

Good fit Use it to build and organize iPhone, iPad, macOS, and other Apple-platform interfaces with SwiftUI.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/majiang213/openclaw-mas/swiftui-patterns
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 majiang213/OpenClaw-MAS --skill swiftui-patterns
Clone the repo
git clone --depth 1 https://github.com/majiang213/OpenClaw-MAS

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-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/majiang213/openclaw-mas/swiftui-patterns/github.svg)](https://agentmods.dev/skills/majiang213/openclaw-mas/swiftui-patterns)
Your own site
<a href="https://agentmods.dev/skills/majiang213/openclaw-mas/swiftui-patterns"><img src="https://agentmods.dev/badge/skills/majiang213/openclaw-mas/swiftui-patterns/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-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/majiang213/openclaw-mas/swiftui-patterns"><img src="https://agentmods.dev/badge/skills/majiang213/openclaw-mas/swiftui-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 34 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,565 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 94% copy Near-identical to another mod 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.00034 $0.01565
Opus 5 $0.00017 $0.00783
Sonnet 5 $0.00007 $0.00313
Haiku 4.5 $0.00003 $0.00156

Measured 5d ago against content hash c27f90145101, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

swiftui-patterns 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 5d 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

This is a copy

94% identical to swiftui-patterns — 3 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

ecc-skills/swiftui-patterns/SKILL.md · 260 lines

How it starts

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

SwiftUI Patterns

Modern SwiftUI patterns for building declarative, performant user interfaces on Apple platforms. Covers the Observation framework, view composition, type-safe navigation, and performance optimization.

When to Activate

  • Building SwiftUI views and managing state (@State, @Observable, @Binding)
  • Designing navigation flows with NavigationStack
  • Structuring view models and data flow
  • Optimizing rendering performance for lists and complex layouts
  • Working with environment values and dependency injection in SwiftUI

State Management

Property Wrapper Selection

Choose the simplest wrapper that fits:

Wrapper Use Case
@State View-local value types (toggles, form fields, sheet presentation)
@Binding Two-way reference to parent's @State
@Observable class + @State Owned model with multiple properties
@Observable class (no wrapper) Read-only reference passed from parent
@Bindable Two-way binding to an @Observable property
@Environment Shared dependencies injected via .environment()

@Observable ViewModel

Use @Observable (not ObservableObject) — it tracks property-level changes so SwiftUI only re-renders views that read the changed property:

@Observable
final class ItemListViewModel {
    private(set) var items: [Item] = []
    private(set) var isLoading = false
    var searchText = ""

    private let repository: any ItemRepository

    init(repository: any ItemRepository = DefaultItemRepository()) {
        self.repository = repository
    }

    func load() async {
        isLoading = true
        defer { isLoading = false }
        items = (try? await repository.fetchAll()) ?? []
    }
}

View Consuming the ViewModel

struct ItemListView: View {
    @State private var viewModel: ItemListViewModel

    init(viewModel: ItemListViewModel = ItemListViewModel()) {
        _viewModel = State(initialValue: viewModel)
    }

    var body: some View {
        List(viewModel.items) { item in
            ItemRow(item: item)
        }
        .searchable(text: $viewModel.searchText)
        .overlay { if viewModel.isLoading { ProgressView() } }
        .task { await viewModel.load() }
    }
}

Read the full file on GitHub · 260 lines

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. 5d ago First seen · 260 lines · 34 tokens per session scan A c27f90145101

Subscribe to this mod's changes

swiftui-patterns is a skill published in the GitHub repository majiang213/OpenClaw-MAS (5 stars, last pushed 5mo ago), licensed MIT. It adds 34 tokens to every session and 1,565 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 94% identical to swiftui-patterns, differing in 3 lines, and is treated as a copy.

Related

Other skills, from other repositories

tauri-expert

Expert skill for Tauri (v2) development, Rust backend, IPC, and security / Panduan ahli untuk pengembangan Tauri v2, Rust backend, IPC, dan keamanan.

roedyrustam/vibes-plug · 43 tokens

axiom-mapkit-ref

MapKit API reference — SwiftUI Map, MKMapView, Marker, Annotation, MKLocalSearch, MKDirections, Look Around, MKMapSnapshotter, clustering, overlays, GeoToolbox PlaceDescriptor, geocoding.

ComeOnOliver/skillshub · 51 tokens

axiom-swift-concurrency

Use when you see 'actor-isolated', 'Sendable', 'data race', '@MainActor' errors, or when asking 'why is this not thread safe', 'how do I use async/await', 'what is @MainActor for', 'my app is crashing with concurrency errors', 'how do I fix data races' - Swift 6 strict concurrency patterns with actor isolation and…

ComeOnOliver/skillshub · 89 tokens

axiom-apple-docs

Use when ANY question involves Apple framework APIs, Swift compiler errors, or Xcode-bundled documentation. Covers Liquid Glass, Swift 6.2 concurrency, Foundation Models, SwiftData, StoreKit, 32 Swift compiler diagnostics.

ComeOnOliver/skillshub · 54 tokens

axiom-assume-isolated

Use when needing synchronous actor access in tests, legacy delegate callbacks, or performance-critical code. Covers MainActor.assumeIsolated, @preconcurrency protocol conformances, crash behavior, Task vs assumeIsolated.

ComeOnOliver/skillshub · 50 tokens

update-swiftui-apis

Scan Apple's SwiftUI documentation for deprecated APIs and update the SwiftUI Expert Skill with modern replacements. Use when asked to "update latest APIs", "refresh deprecated SwiftUI APIs", "check for new SwiftUI deprecations", "scan for API changes", or after a new iOS/Xcode release. Requires the Sosumi MCP to be…

ComeOnOliver/skillshub · 77 tokens