Structures and refactors SwiftUI views using Observation, clear state ownership, composition, and deterministic previews. Use for view architecture and data flow.
Ships in all-ios-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Build SwiftUI features whose state ownership, dependencies, lifecycle work, and view boundaries are easy to understand and verify.
This skill owns:
Route detailed containers and controls to swiftui-layout-components, cross-size clipping and overlap diagnosis to swiftui-responsive-layout, navigation to swiftui-navigation, motion to swiftui-animation, runtime diagnosis to swiftui-performance, Liquid Glass to swiftui-liquid-glass, concurrency mechanics to swift-concurrency, and architecture selection beyond a single feature to swift-architecture.
Inspect the project's deployment target, Swift language mode, and available SDK before recommending versioned APIs. Preserve those settings unless the user requests a change; gate newer APIs and verify availability against SDK headers or primary Apple/Swift documentation. Building with Xcode 27 changes @State to a macro with source-breaking edge cases and deprecates PreviewProvider and FileDocument; read iOS 27 Updates before upgrading a project.
body declarative; move meaningful sections into dedicated views and non-trivial actions into thin named methods.For an existing large view, read Behavior-Preserving View Refactoring. For project layout or naming work, read Project Structure and File Naming.
| Tool | Use when |
|---|---|
@State | The view owns a local value or @Observable instance. Keep it private unless an API genuinely requires broader access. |
let | A child receives observable state but does not need bindings. |
@Bindable | A child receives an @Observable value and needs $property bindings. |
@Binding | A child edits state owned by its parent. |
@Environment(Type.self) | A cohesive dependency or shared observable model is needed deeply in a subtree. |
@Query | A SwiftData-backed view owns a live query. Route persistence details to swiftdata. |
UI-bound observable stores should normally be @MainActor. Domain values that cross isolation boundaries need an appropriate isolation strategy and, where correct, Sendable; do not mark every observable type @MainActor by habit.
Prefer lightweight MV for straightforward SwiftUI features. Introduce MVVM, MVI, TCA, or another boundary when concrete complexity justifies it, or preserve the architecture already established by the project. Use swift-architecture to make that choice.
Keep a small stateless fragment as a computed some View. Extract a dedicated View when a section has one or more of these signals:
Pass only the values, bindings, and actions the child needs. A cohesive feature-scoped observable model is appropriate when many related inputs would otherwise travel together. Reuse is helpful but is not required for extraction.
Extensions and // MARK: headings organize source; they do not create runtime or ownership boundaries. Avoid replacing one oversized body with screen-sized computed properties.
Use environment injection for genuinely shared dependencies, not as a shortcut for every value. Required dependencies should remain required; install deterministic preview/test substitutes instead of making production types optional.
Prefer .task or .task(id:) for async work tied to view lifetime because SwiftUI cancels it with the view. A manually stored Task is appropriate when work must outlive a modifier scope or requires explicit cancellation. Route debounce, clocks, cancellation handlers, actors, and AsyncSequence to swift-concurrency.
Create deterministic previews for meaningful loaded, loading, empty, and error states as applicable. Install every required environment value and use in-memory or temporary persistence. Do not call live APIs, production authentication, Keychain state, or global databases from previews.
Read Isolated Preview Construction when a preview needs fixtures, persistence, or environment setup.
@Observable model inside a view without @State, causing it to re-initialize on every render.body property.\.self) as id in ForEach for mutable, sortable collections..onAppear without cancellation tracking or .task.@State macro, ContentBuilder, documents, and iOS 27 deprecations: references/ios27-updates.mdevals/evals.json (opens in a new tab)references/architecture-patterns.md (opens in a new tab)references/design-polish.md (opens in a new tab)references/ios27-updates.md (opens in a new tab)references/migration-data-and-modern-apis.md (opens in a new tab)references/migration-navigation-observation.md (opens in a new tab)references/migration-view-lifecycle-layout.md (opens in a new tab)references/platform-and-sharing.md (opens in a new tab)references/preview-isolation.md (opens in a new tab)references/project-structure.md (opens in a new tab)references/view-refactoring.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
swiftui, view-architecture, state-ownership, composition, previews
/all-ios-skills:swiftui-patternsfrom all-ios-skills
npx claudepluginhub thienqo/ios-skills --plugin all-ios-skills95 skills in this plugin
/accessorysetupkitDiscover and configure Bluetooth and Wi-Fi accessories using AccessorySetupKit. Use when presenting a privacy-preserving accessory picker, defining discovery descriptors for BLE or Wi-Fi devices, handling accessory session events, migrating from CoreBluetooth permission-based scanning, or setting up accessories without requiring broad Bluetooth permissions./activitykitBuild or review Live Activities and Dynamic Island experiences with ActivityKit, including lifecycle, layouts, push updates, and scheduled delivery. Use for time-sensitive Lock Screen or Dynamic Island state; route ordinary widgets to widgetkit./adattributionkitMeasure ad effectiveness with privacy-preserving attribution using AdAttributionKit. Use when registering ad impressions, handling attribution postbacks, updating conversion values, implementing re-engagement attribution, configuring publisher or advertiser apps, or replacing SKAdNetwork with AdAttributionKit for ad measurement.Other plugins' skills for the same job