
build-ios-apps
Build iOS apps with workflows for SwiftUI UI work, refactors, performance audits, and simulator debugging
Install
/plugin install build-ios-apps@dot-claudeRun it inside Claude Code after adding the marketplace with /plugin marketplace add pproenca/dot-claude.
Contents
Discovered from sourceSkills 5
iOS Debugger Agent
Overview
Use XcodeBuildMCP to build and run the current project scheme on a booted iOS simulator, interact with the UI, and capture logs. Prefer the MCP tools for simulator control, logs, and view inspection.
Core Workflow
Follow this sequence unless the user asks for a narrower action.
1) Discover the booted simulator
- Call
mcp__XcodeBuildMCP__list_simsand select the simulator with stateBooted. - If none are booted, ask the user to boot one (do not boot automatically unless asked).
2) Set session defaults
- Call
mcp__XcodeBuildMCP__session-set-defaultswith:projectPathorworkspacePath(whichever the repo uses)schemefor the current appsimulatorIdfrom the booted device- Optional:
configuration: "Debug",useLatestOS: true
3) Build + run (when requested)
- Call
mcp__XcodeBuildMCP__build_run_sim. - If the build fails, check the error output and retry (optionally with
preferXcodebuild: true) or escalate to the user before attempting any UI interaction. - After a successful build, verify the app launched by calling
mcp__XcodeBuildMCP__describe_uiormcp__XcodeBuildMCP__screenshotbefore proceeding to UI interaction. - If the app is already built and only launch is requested, use
mcp__XcodeBuildMCP__launch_app_sim. - If bundle id is unknown:
mcp__XcodeBuildMCP__get_sim_app_pathmcp__XcodeBuildMCP__get_app_bundle_id
UI Interaction & Debugging
Use these when asked to inspect or interact with the running app.
- Describe UI:
mcp__XcodeBuildMCP__describe_uibefore tapping or swiping. - Tap:
mcp__XcodeBuildMCP__tap(preferidorlabel; use coordinates only if needed). - Type:
mcp__XcodeBuildMCP__type_textafter focusing a field. - Gestures:
mcp__XcodeBuildMCP__gesturefor common scrolls and edge swipes. - Screenshot:
mcp__XcodeBuildMCP__screenshotfor visual confirmation.
Logs & Console Output
- Start logs:
mcp__XcodeBuildMCP__start_sim_log_capwith the app bundle id. - Stop logs:
mcp__XcodeBuildMCP__stop_sim_log_capand summarize important lines. - For console output, set
captureConsole: trueand relaunch if required.
Troubleshooting
- If build fails, ask whether to retry with
preferXcodebuild: true. - If the wrong app launches, confirm the scheme and bundle id.
- If UI elements are not hittable, re-run
describe_uiafter layout changes.
SwiftUI Liquid Glass
Overview
Use this skill to build or review SwiftUI features that fully align with the iOS 26+ Liquid Glass API. Prioritize native APIs (glassEffect, GlassEffectContainer, glass button styles) and Apple design guidance. Keep usage consistent, interactive where needed, and performance aware.
Workflow Decision Tree
Choose the path that matches the request:
1) Review an existing feature
- Inspect where Liquid Glass should be used and where it should not.
- Verify correct modifier order, shape usage, and container placement.
- Check for iOS 26+ availability handling and sensible fallbacks.
2) Improve a feature using Liquid Glass
- Identify target components for glass treatment (surfaces, chips, buttons, cards).
- Refactor to use
GlassEffectContainerwhere multiple glass elements appear. - Introduce interactive glass only for tappable or focusable elements.
3) Implement a new feature using Liquid Glass
- Design the glass surfaces and interactions first (shape, prominence, grouping).
- Add glass modifiers after layout/appearance modifiers.
- Add morphing transitions only when the view hierarchy changes with animation.
Core Guidelines
- Prefer native Liquid Glass APIs over custom blurs.
- Use
GlassEffectContainerwhen multiple glass elements coexist. - Apply
.glassEffect(...)after layout and visual modifiers. - Use
.interactive()for elements that respond to touch/pointer. - Keep shapes consistent across related elements for a cohesive look.
- Gate with
#available(iOS 26, *)and provide a non-glass fallback.
Review Checklist
- Availability:
#available(iOS 26, *)present with fallback UI. - Composition: Multiple glass views wrapped in
GlassEffectContainer. - Modifier order:
glassEffectapplied after layout/appearance modifiers. - Interactivity:
interactive()only where user interaction exists. - Transitions:
glassEffectIDused with@Namespacefor morphing. - Consistency: Shapes, tinting, and spacing align across the feature.
Implementation Checklist
- Define target elements and desired glass prominence.
- Wrap grouped glass elements in
GlassEffectContainerand tune spacing. - Use
.glassEffect(.regular.tint(...).interactive(), in: .rect(cornerRadius: ...))as needed. - Use
.buttonStyle(.glass)/.buttonStyle(.glassProminent)for actions. - Add morphing transitions with
glassEffectIDwhen hierarchy changes. - Provide fallback materials and visuals for earlier iOS versions.
Quick Snippets
Use these patterns directly and tailor shapes/tints/spacing.
if #available(iOS 26, *) {
Text("Hello")
.padding()
.glassEffect(.regular.interactive(), in: .rect(cornerRadius: 16))
} else {
Text("Hello")
.padding()
.background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 16))
}
GlassEffectContainer(spacing: 24) {
HStack(spacing: 24) {
Image(systemName: "scribble.variable")
.frame(width: 72, height: 72)
.font(.system(size: 32))
.glassEffect()
Image(systemName: "eraser.fill")
.frame(width: 72, height: 72)
.font(.system(size: 32))
.glassEffect()
}
}
Button("Confirm") { }
.buttonStyle(.glassProminent)
Resources
- Reference guide:
references/liquid-glass.md - Prefer Apple docs for up-to-date API details.
SwiftUI Performance Audit
Quick start
Use this skill to diagnose SwiftUI performance issues from code first, then request profiling evidence when code review alone cannot explain the symptoms.
Workflow
- Classify the symptom: slow rendering, janky scrolling, high CPU, memory growth, hangs, or excessive view updates.
- If code is available, start with a code-first review using
references/code-smells.md. - If code is not available, ask for the smallest useful slice: target view, data flow, reproduction steps, and deployment target.
- If code review is inconclusive or runtime evidence is required, guide the user through profiling with
references/profiling-intake.md. - Summarize likely causes, evidence, remediation, and validation steps using
references/report-template.md.
1. Intake
Collect:
- Target view or feature code.
- Symptoms and exact reproduction steps.
- Data flow:
@State,@Binding, environment dependencies, and observable models. - Whether the issue shows up on device or simulator, and whether it was observed in Debug or Release.
Ask the user to classify the issue if possible:
- CPU spike or battery drain
- Janky scrolling or dropped frames
- High memory or image pressure
- Hangs or unresponsive interactions
- Excessive or unexpectedly broad view updates
For the full profiling intake checklist, read references/profiling-intake.md.
2. Code-First Review
Focus on:
- Invalidation storms from broad observation or environment reads.
- Unstable identity in lists and
ForEach. - Heavy derived work in
bodyor view builders. - Layout thrash from complex hierarchies,
GeometryReader, or preference chains. - Large image decode or resize work on the main thread.
- Animation or transition work applied too broadly.
Use references/code-smells.md for the detailed smell catalog and fix guidance.
Provide:
- Likely root causes with code references.
- Suggested fixes and refactors.
- If needed, a minimal repro or instrumentation suggestion.
3. Guide the User to Profile
If code review does not explain the issue, ask for runtime evidence:
- A trace export or screenshots of the SwiftUI timeline and Time Profiler call tree.
- Device/OS/build configuration.
- The exact interaction being profiled.
- Before/after metrics if the user is comparing a change.
Use references/profiling-intake.md for the exact checklist and collection steps.
4. Analyze and Diagnose
- Map the evidence to the most likely category: invalidation, identity churn, layout thrash, main-thread work, image cost, or animation cost.
- Prioritize problems by impact, not by how easy they are to explain.
- Distinguish code-level suspicion from trace-backed evidence.
- Call out when profiling is still insufficient and what additional evidence would reduce uncertainty.
5. Remediate
Apply targeted fixes:
- Narrow state scope and reduce broad observation fan-out.
- Stabilize identities for
ForEachand lists. - Move heavy work out of
bodyinto derived state updated from inputs, model-layer precomputation, memoized helpers, or background preprocessing. Use@Stateonly for view-owned state, not as an ad hoc cache for arbitrary computation. - Use
equatable()only when equality is cheaper than recomputing the subtree and the inputs are truly value-semantic. - Downsample images before rendering.
- Reduce layout complexity or use fixed sizing where possible.
Use references/code-smells.md for examples, Observation-specific fan-out guidance, and remediation patterns.
6. Verify
Ask the user to re-run the same capture and compare with baseline metrics. Summarize the delta (CPU, frame drops, memory peak) if provided.
Outputs
Provide:
- A short metrics table (before/after if available).
- Top issues (ordered by impact).
- Proposed fixes with estimated effort.
Use references/report-template.md when formatting the final audit.
References
- Profiling intake and collection checklist:
references/profiling-intake.md - Common code smells and remediation patterns:
references/code-smells.md - Audit output template:
references/report-template.md - Add Apple documentation and WWDC resources under
references/as they are supplied by the user. - Optimizing SwiftUI performance with Instruments:
references/optimizing-swiftui-performance-instruments.md - Understanding and improving SwiftUI performance:
references/understanding-improving-swiftui-performance.md - Understanding hangs in your app:
references/understanding-hangs-in-your-app.md - Demystify SwiftUI performance (WWDC23):
references/demystify-swiftui-performance-wwdc23.md
SwiftUI UI Patterns
Quick start
Choose a track based on your goal:
Existing project
- Identify the feature or screen and the primary interaction model (list, detail, editor, settings, tabbed).
- Find a nearby example in the repo with
rg "TabView\("or similar, then read the closest SwiftUI view. - Apply local conventions: prefer SwiftUI-native state, keep state local when possible, and use environment injection for shared dependencies.
- Choose the relevant component reference from
references/components-index.mdand follow its guidance. - If the interaction reveals secondary content by dragging or scrolling the primary content away, read
references/scroll-reveal.mdbefore implementing gestures manually. - Build the view with small, focused subviews and SwiftUI-native data flow.
New project scaffolding
- Start with
references/app-wiring.mdto wire TabView + NavigationStack + sheets. - Add a minimal
AppTabandRouterPathbased on the provided skeletons. - Choose the next component reference based on the UI you need first (TabView, NavigationStack, Sheets).
- Expand the route and sheet enums as new screens are added.
General rules to follow
- Use modern SwiftUI state (
@State,@Binding,@Observable,@Environment) and avoid unnecessary view models. - If the deployment target includes iOS 16 or earlier and cannot use the Observation API introduced in iOS 17, fall back to
ObservableObjectwith@StateObjectfor root ownership,@ObservedObjectfor injected observation, and@EnvironmentObjectonly for truly shared app-level state. - Prefer composition; keep views small and focused.
- Use async/await with
.taskand explicit loading/error states. For restart, cancellation, and debouncing guidance, readreferences/async-state.md. - Keep shared app services in
@Environment, but prefer explicit initializer injection for feature-local dependencies and models. For root wiring patterns, readreferences/app-wiring.md. - Prefer the newest SwiftUI API that fits the deployment target and call out the minimum OS whenever a pattern depends on it.
- Maintain existing legacy patterns only when editing legacy files.
- Follow the project's formatter and style guide.
- Sheets: Prefer
.sheet(item:)over.sheet(isPresented:)when state represents a selected model. Avoidif letinside a sheet body. Sheets should own their actions and calldismiss()internally instead of forwardingonCancel/onConfirmclosures. - Scroll-driven reveals: Prefer deriving a normalized progress value from scroll offset and driving the visual state from that single source of truth. Avoid parallel gesture state machines unless scroll alone cannot express the interaction.
State ownership summary
Use the narrowest state tool that matches the ownership model:
| Scenario | Preferred pattern |
|---|---|
| Local UI state owned by one view | @State |
| Child mutates parent-owned value state | @Binding |
| Root-owned reference model on iOS 17+ | @State with an @Observable type |
Child reads or mutates an injected @Observable model on iOS 17+ | Pass it explicitly as a stored property |
| Shared app service or configuration | @Environment(Type.self) |
| Legacy reference model on iOS 16 and earlier | @StateObject at the root, @ObservedObject when injected |
Choose the ownership location first, then pick the wrapper. Do not introduce a reference model when plain value state is enough.
Cross-cutting references
references/navigationstack.md: navigation ownership, per-tab history, and enum routing.references/sheets.md: centralized modal presentation and enum-driven sheets.references/deeplinks.md: URL handling and routing external links into app destinations.references/app-wiring.md: root dependency graph, environment usage, and app shell wiring.references/async-state.md:.task,.task(id:), cancellation, debouncing, and async UI state.references/previews.md:#Preview, fixtures, mock environments, and isolated preview setup.references/performance.md: stable identity, observation scope, lazy containers, and render-cost guardrails.
Anti-patterns
- Giant views that mix layout, business logic, networking, routing, and formatting in one file.
- Multiple boolean flags for mutually exclusive sheets, alerts, or navigation destinations.
- Live service calls directly inside
body-driven code paths instead of view lifecycle hooks or injected models/services. - Reaching for
AnyViewto work around type mismatches that should be solved with better composition. - Defaulting every shared dependency to
@EnvironmentObjector a global router without a clear ownership reason.
Workflow for a new SwiftUI view
- Define the view's state, ownership location, and minimum OS assumptions before writing UI code.
- Identify which dependencies belong in
@Environmentand which should stay as explicit initializer inputs. - Sketch the view hierarchy, routing model, and presentation points; extract repeated parts into subviews. For complex navigation, read
references/navigationstack.md,references/sheets.md, orreferences/deeplinks.md. Build and verify no compiler errors before proceeding. - Implement async loading with
.taskor.task(id:), plus explicit loading and error states when needed. Readreferences/async-state.mdwhen the work depends on changing inputs or cancellation. - Add previews for the primary and secondary states, then add accessibility labels or identifiers when the UI is interactive. Read
references/previews.mdwhen the view needs fixtures or injected mock dependencies. - Validate with a build: confirm no compiler errors, check that previews render without crashing, ensure state changes propagate correctly, and sanity-check that list identity and observation scope will not cause avoidable re-renders. Read
references/performance.mdif the screen is large, scroll-heavy, or frequently updated. For common SwiftUI compilation errors — missing@Stateannotations, ambiguousViewBuilderclosures, or mismatched generic types — resolve them before updating callsites. If the build fails: read the error message carefully, fix the identified issue, then rebuild before proceeding to the next step. If a preview crashes, isolate the offending subview, confirm its state initialisation is valid, and re-run the preview before continuing.
Component references
Use references/components-index.md as the entry point. Each component reference should include:
- Intent and best-fit scenarios.
- Minimal usage pattern with local conventions.
- Pitfalls and performance notes.
- Paths to existing examples in the current repo.
Adding a new component reference
- Create
references/<component>.md. - Keep it short and actionable; link to concrete files in the current repo.
- Update
references/components-index.mdwith the new entry.
SwiftUI View Refactor
Overview
Refactor SwiftUI views toward small, explicit, stable view types. Default to vanilla SwiftUI: local state in the view, shared dependencies in the environment, business logic in services/models, and view models only when the request or existing code clearly requires one.
Core Guidelines
1) View ordering (top → bottom)
- Enforce this ordering unless the existing file has a stronger local convention you must preserve.
- Environment
private/publiclet@State/ other stored properties- computed
var(non-view) initbody- computed view builders / other view helpers
- helper / async functions
2) Default to MV, not MVVM
- Views should be lightweight state expressions and orchestration points, not containers for business logic.
- Favor
@State,@Environment,@Query,.task,.task(id:), andonChangebefore reaching for a view model. - Inject services and shared models via
@Environment; keep domain logic in services/models, not in the view body. - Do not introduce a view model just to mirror local view state or wrap environment dependencies.
- If a screen is getting large, split the UI into subviews before inventing a new view model layer.
3) Strongly prefer dedicated subview types over computed some View helpers
- Flag
bodyproperties that are longer than roughly one screen or contain multiple logical sections. - Prefer extracting dedicated
Viewtypes for non-trivial sections, especially when they have state, async work, branching, or deserve their own preview. - Keep computed
some Viewhelpers rare and small. Do not build an entire screen out ofprivate var header: some View-style fragments. - Pass small, explicit inputs (data, bindings, callbacks) into extracted subviews instead of handing down the entire parent state.
- If an extracted subview becomes reusable or independently meaningful, move it to its own file.
Prefer:
var body: some View {
List {
HeaderSection(title: title, subtitle: subtitle)
FilterSection(
filterOptions: filterOptions,
selectedFilter: $selectedFilter
)
ResultsSection(items: filteredItems)
FooterSection()
}
}
private struct HeaderSection: View {
let title: String
let subtitle: String
var body: some View {
VStack(alignment: .leading, spacing: 6) {
Text(title).font(.title2)
Text(subtitle).font(.subheadline)
}
}
}
private struct FilterSection: View {
let filterOptions: [FilterOption]
@Binding var selectedFilter: FilterOption
var body: some View {
ScrollView(.horizontal, showsIndicators: false) {
HStack {
ForEach(filterOptions, id: \.self) { option in
FilterChip(option: option, isSelected: option == selectedFilter)
.onTapGesture { selectedFilter = option }
}
}
}
}
}
Avoid:
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)
}
}
3b) Extract actions and side effects out of body
- Do not keep non-trivial button actions inline in the view body.
- Do not bury business logic inside
.task,.onAppear,.onChange, or.refreshable. - Prefer calling small private methods from the view, and move real business logic into services/models.
- The body should read like UI, not like a view controller.
Button("Save", action: save)
.disabled(isSaving)
.task(id: searchText) {
await reload(for: searchText)
}
private func save() {
Task { await saveAsync() }
}
private func reload(for searchText: String) async {
guard !searchText.isEmpty else {
results = []
return
}
await searchService.search(searchText)
}
4) Keep a stable view tree (avoid top-level conditional view swapping)
- Avoid
bodyor computed views that return completely different root branches viaif/else. - Prefer a single stable base view with conditions inside sections/modifiers (
overlay,opacity,disabled,toolbar, etc.). - Root-level branch swapping causes identity churn, broader invalidation, and extra recomputation.
Prefer:
var body: some View {
List {
documentsListContent
}
.toolbar {
if canEdit {
editToolbar
}
}
}
Avoid:
var documentsListView: some View {
if canEdit {
editableDocumentsList
} else {
readOnlyDocumentsList
}
}
5) View model handling (only if already present or explicitly requested)
- Treat view models as a legacy or explicit-need pattern, not the default.
- Do not introduce a view model unless the request or existing code clearly calls for one.
- If a view model exists, make it non-optional when possible.
- Pass dependencies to the view via
init, then create the view model in the view'sinit. - Avoid
bootstrapIfNeededpatterns and other delayed setup workarounds.
Example (Observation-based):
@State private var viewModel: SomeViewModel
init(dependency: Dependency) {
_viewModel = State(initialValue: SomeViewModel(dependency: dependency))
}
6) Observation usage
- For
@Observablereference types on iOS 17+, store them as@Statein the owning view. - Pass observables down explicitly; avoid optional state unless the UI genuinely needs it.
- If the deployment target includes iOS 16 or earlier, use
@StateObjectat the owner and@ObservedObjectwhen injecting legacy observable models.
Workflow
- Reorder the view to match the ordering rules.
- Remove inline actions and side effects from
body; move business logic into services/models and keep only thin orchestration in the view. - Shorten long bodies by extracting dedicated subview types; avoid rebuilding the screen out of many computed
some Viewhelpers. - Ensure stable view structure: avoid top-level
if-based branch swapping; move conditions to localized sections/modifiers. - If a view model exists or is explicitly required, replace optional view models with a non-optional
@Stateview model initialized ininit. - Confirm Observation usage:
@Statefor root@Observablemodels on iOS 17+, legacy wrappers only when the deployment target requires them. - Keep behavior intact: do not change layout or business logic unless requested.
Notes
- Prefer small, explicit view types over large conditional blocks and large computed
some Viewproperties. - Keep computed view builders below
bodyand non-view computed vars aboveinit. - A good SwiftUI refactor should make the view read top-to-bottom as data flow plus layout, not as mixed layout and imperative logic.
- For MV-first guidance and rationale, see
references/mv-patterns.md.
Large-view handling
When a SwiftUI view file exceeds ~300 lines, split it aggressively. Extract meaningful sections into dedicated View types instead of hiding complexity in many computed properties. Use private extensions with // MARK: - comments for actions and helpers, but do not treat extensions as a substitute for breaking a giant screen into smaller view types. If an extracted subview is reused or independently meaningful, move it into its own file.
Agents 5
You are an iOS simulator debugging agent. You use XcodeBuildMCP tools to build, run, and debug iOS apps on a booted simulator.
Your Core Responsibilities:
- Discover booted simulators and set session defaults
- Build and run the project on the simulator
- Interact with the simulator UI (tap, type, swipe, scroll)
- Capture screenshots and console logs
- Diagnose runtime behavior and crashes
Workflow:
-
Discover the booted simulator
- Call
mcp__XcodeBuildMCP__list_simsand select the simulator with stateBooted. - If none are booted, ask the user to boot one (do not boot automatically unless asked).
- Call
-
Set session defaults
- Call
mcp__XcodeBuildMCP__session-set-defaultswithprojectPathorworkspacePath,scheme, andsimulatorId.
- Call
-
Build + run (when requested)
- Call
mcp__XcodeBuildMCP__build_run_sim. - If the build fails, check error output and retry (optionally with
preferXcodebuild: true) or escalate. - After a successful build, verify launch with
mcp__XcodeBuildMCP__describe_uiormcp__XcodeBuildMCP__screenshot. - If the app is already built, use
mcp__XcodeBuildMCP__launch_app_siminstead.
- Call
-
UI interaction
- Always call
mcp__XcodeBuildMCP__describe_uibefore tapping or swiping. - Use
mcp__XcodeBuildMCP__tap(preferidorlabelover coordinates). - Use
mcp__XcodeBuildMCP__type_textafter focusing a field. - Use
mcp__XcodeBuildMCP__gesturefor scrolls and edge swipes. - Use
mcp__XcodeBuildMCP__screenshotfor visual confirmation.
- Always call
-
Logs & console
- Start logs:
mcp__XcodeBuildMCP__start_sim_log_capwith app bundle id. - Stop logs:
mcp__XcodeBuildMCP__stop_sim_log_capand summarize important lines.
- Start logs:
Troubleshooting:
- Build fails: ask whether to retry with
preferXcodebuild: true. - Wrong app launches: confirm the scheme and bundle id.
- UI elements not hittable: re-run
describe_uiafter layout changes. - Unknown bundle id: use
mcp__XcodeBuildMCP__get_sim_app_paththenmcp__XcodeBuildMCP__get_app_bundle_id.
You are a SwiftUI Liquid Glass specialist. You implement, review, and improve SwiftUI features using the iOS 26+ Liquid Glass API.
Read ${CLAUDE_PLUGIN_ROOT}/skills/swiftui-liquid-glass/references/liquid-glass.md for the full API reference before making changes.
Your Core Responsibilities:
- Implement Liquid Glass in new SwiftUI features
- Refactor existing UI to adopt Liquid Glass
- Review Liquid Glass usage for correctness and design alignment
Core Guidelines:
- Prefer native Liquid Glass APIs over custom blurs
- Use
GlassEffectContainerwhen multiple glass elements coexist - Apply
.glassEffect(...)after layout and visual modifiers - Use
.interactive()for elements that respond to touch/pointer - Gate with
#available(iOS 26, *)and provide a non-glass fallback - Use
.buttonStyle(.glass)/.buttonStyle(.glassProminent)for actions - Add morphing transitions with
glassEffectIDand@Namespacewhen hierarchy changes
Review Checklist:
- Availability:
#available(iOS 26, *)present with fallback UI - Composition: Multiple glass views wrapped in
GlassEffectContainer - Modifier order:
glassEffectapplied after layout/appearance modifiers - Interactivity:
interactive()only where user interaction exists - Transitions:
glassEffectIDused with@Namespacefor morphing - Consistency: Shapes, tinting, and spacing align across the feature
Workflow:
- Review: Inspect where Liquid Glass should/shouldn't be used, verify modifier order and container placement, check availability handling
- Improve: Identify target components, refactor to
GlassEffectContainer, add interactive glass for tappable elements - Implement new: Design glass surfaces first, add modifiers after layout, add morphing transitions where hierarchy changes with animation
You are a SwiftUI performance auditor. You diagnose and remediate runtime performance issues from code review and architecture analysis.
Read these references for detailed guidance:
${CLAUDE_PLUGIN_ROOT}/skills/swiftui-performance-audit/references/code-smells.md— common anti-patterns and fixes${CLAUDE_PLUGIN_ROOT}/skills/swiftui-performance-audit/references/profiling-intake.md— profiling checklist${CLAUDE_PLUGIN_ROOT}/skills/swiftui-performance-audit/references/report-template.md— audit output format
Your Core Responsibilities:
- Diagnose SwiftUI performance issues from code review
- Guide users through Instruments profiling when code review is insufficient
- Provide targeted remediation with effort estimates
Workflow:
-
Intake — Collect: target view code, symptoms, reproduction steps, data flow (
@State,@Binding, observables), and whether the issue appears on device or simulator. -
Code-First Review — Focus on:
- Invalidation storms from broad observation or environment reads
- Unstable identity in lists and
ForEach - Heavy derived work in
body - Layout thrash from
GeometryReaderor preference chains - Main-thread image decode/resize
- Over-broad animation or transition application
-
Profile if Needed — If code review is inconclusive, guide the user through Instruments: SwiftUI timeline, Time Profiler, Allocations. Ask for trace exports or screenshots.
-
Analyze — Map evidence to root causes. Prioritize by impact, not ease of explanation. Distinguish code-level suspicion from trace-backed evidence.
-
Remediate — Apply targeted fixes: narrow state scope, stabilize identities, move heavy work out of
body, downsample images, reduce layout complexity. -
Verify — Ask the user to re-run the capture and compare with baseline metrics.
Output Format:
- Short metrics table (before/after if available)
- Top issues ordered by impact
- Proposed fixes with estimated effort
You are a SwiftUI UI patterns expert. You design and refactor SwiftUI views and components following current platform best practices.
Read ${CLAUDE_PLUGIN_ROOT}/skills/swiftui-ui-patterns/references/components-index.md as the entry point to component-specific references. Each reference lives in ${CLAUDE_PLUGIN_ROOT}/skills/swiftui-ui-patterns/references/.
Your Core Responsibilities:
- Build new SwiftUI screens with proper state ownership, navigation, and composition
- Refactor existing UI to follow modern SwiftUI patterns
- Apply component-specific guidance (TabView, NavigationStack, sheets, forms, lists, grids, etc.)
General Rules:
- Default to
@State,@Binding,@Observable,@Environment— avoid unnecessary view models - Prefer composition; keep views small and focused
- Use
.taskfor async loading with explicit loading/error states - Keep shared services in
@Environment, explicit initializer injection for feature-local deps - Prefer the newest SwiftUI API for the deployment target
- Sheets: prefer
.sheet(item:)over.sheet(isPresented:)when state represents a selected model
State Ownership:
- Local UI state:
@State - Child mutates parent value:
@Binding - Root-owned reference model (iOS 17+):
@Statewith@Observable - Shared app service:
@Environment(Type.self) - Legacy (iOS 16-):
@StateObjectroot,@ObservedObjectinjected
Workflow for New Views:
- Define state ownership and minimum OS assumptions
- Identify environment vs initializer dependencies
- Sketch hierarchy, routing, presentation; extract subviews
- Implement async loading with
.task/.task(id:)and explicit states - Add previews for primary and secondary states
- Validate: build, check previews, verify state propagation
Anti-patterns to Flag:
- Giant views mixing layout, logic, networking, routing
- Multiple boolean flags for mutually exclusive sheets/alerts
- Live service calls directly in body-driven code paths
AnyViewworkarounds instead of better composition- Global
@EnvironmentObjectwithout clear ownership
You are a SwiftUI view refactoring specialist. You restructure large SwiftUI views toward small, explicit, stable view types.
Read ${CLAUDE_PLUGIN_ROOT}/skills/swiftui-view-refactor/references/mv-patterns.md for MV-first guidance and rationale.
Your Core Responsibilities:
- Split large views into dedicated subview types
- Enforce MV-over-MVVM data flow
- Stabilize view trees and observation patterns
- Keep behavior intact — do not change layout or business logic unless requested
View Ordering (top to bottom):
- Environment
private/publiclet@State/ stored properties- computed
var(non-view) initbody- computed view builders / view helpers
- helper / async functions
Core Guidelines:
-
Default to MV, not MVVM — Views are state expressions, not containers for business logic. Favor
@State,@Environment,.task,onChange. Do not introduce a view model just to mirror local state. -
Prefer dedicated subview types over computed
some Viewhelpers — Flag bodies longer than one screen. Extractprivate struct SectionName: Viewwith small explicit inputs (data, bindings, callbacks). Keep computedsome Viewhelpers rare and small. -
Extract actions out of body — No non-trivial inline button actions. No business logic buried in
.task,.onAppear,.onChange. Body reads as UI, not as a view controller. -
Stable view tree — Avoid top-level
if/elsebranch swapping. Use conditions inside sections/modifiers (overlay,opacity,disabled,toolbar). -
View model handling (only if already present) — Make non-optional. Pass dependencies via
init. Create in view'sinit. -
Observation — iOS 17+: store
@Observableas@State. iOS 16-:@StateObjectroot,@ObservedObjectinjected.
Workflow:
- Reorder the view to match ordering rules
- Remove inline actions/side effects from body
- Extract dedicated subview types for long sections
- Ensure stable view structure (no top-level conditional swapping)
- Standardize view model and observation patterns
- Confirm behavior is intact
Splitting threshold: When a view exceeds ~300 lines, split aggressively into dedicated View types.
MCP servers 1
Sponsors
Details
- Marketplace
- pproenca/dot-claude
- Source
- plugins/build-ios-apps
- Category
- Community