SwiftUI Dev
Use this skill for SwiftUI development, architecture, structure, performance, and Apple native app profiling. It combines:
- SwiftUI view refactor and Observation/MV guidance.
- SwiftUI code-first performance audit.
- Native macOS/iOS Time Profiler CLI workflow with
xctrace, atos, and included scripts.
Do not use this skill for web performance, server profiling, generic PR review, product planning, or non-Apple UI frameworks. For ordinary implementation work without SwiftUI architecture/performance/native profiling concerns, use the development skill.
Route The Work
| User intent |
Read |
Refactor SwiftUI View structure, split large body, review Observation / MV / ViewModel boundaries |
references/swiftui-refactor.md |
| SwiftUI page is slow, scrolling janks, body updates too often, Instruments trace needs interpretation |
references/swiftui-performance.md |
| Record/analyze macOS or iOS native Time Profiler traces from CLI, symbolicate and rank hotspots |
references/native-trace.md |
| Need deeper Apple/WWDC context for SwiftUI update causes, hangs, Instruments lanes |
Read the specific Apple summary files listed in the relevant reference |
If the user provides only symptoms, start with code-first SwiftUI review. Ask for trace/screenshots only when code review is inconclusive or the user explicitly wants trace analysis.
Required Inputs
For SwiftUI code review:
- Target view or feature code.
- Data flow:
@State, @Binding, @Environment, @Observable, @Query, services, models.
- Symptoms and reproduction steps.
- Device/OS/build configuration when performance is involved.
For native profiling:
- App name and binary path, or existing
.trace bundle.
- Attach PID or launch binary path.
- Slow interaction to exercise during capture.
- Capture duration, defaulting to 90 seconds.
- Matching symbols / binary and permission to launch or attach.
Proceed with explicit assumptions for code-only reviews. Stop before profiling if required tools or permissions are missing.
Core Workflow
- Classify the task: SwiftUI structure/refactor, SwiftUI performance, or native trace profiling.
- Start code-first for SwiftUI: inspect structure, data flow, Observation ownership, identity, layout, and body work before requesting heavier tooling.
- Use Instruments evidence when available: treat traces/screenshots/CSV as evidence, not as the whole answer.
- Make targeted recommendations: order issues by likely impact and confidence.
- Verify with the same scenario: compare before/after CPU, frame drops, memory peak, sample counts, or the specific user-visible symptom when data exists.
Boundaries
- Do not invent metrics, trace findings, sample counts, call stacks, device settings, or benchmark results.
- Do not run
xctrace unless the user has provided a local target, trace, or explicit permission and the environment is macOS with Xcode tools.
- Do not interpret stale symbols as real hotspots. Binary, trace, and load address must match.
- Do not introduce ViewModels by default. Prefer SwiftUI-native state/data flow unless existing code or user requirements justify a view model.
- Do not change business logic during refactor unless the user explicitly asks.
- If source files must be edited, follow the existing project style and verify with relevant build/tests/profiling.
Output Format
Use this concise structure unless a reference template is more specific:
# SwiftUI Dev Review: [Target]
## Inputs And Assumptions
## Findings
| Priority | Finding | Evidence | Recommendation | Confidence |
|---|---|---|---|---|
## Suggested Changes
## Verification Plan
## Risks / Limits
## Handoff To Next Stage
For native trace analysis, use the report structure in references/native-trace.md.
Quality Checklist
Before finalizing, verify:
- The task is Apple-native or SwiftUI-specific.
- SwiftUI structure recommendations preserve clear data ownership and framework-native state flow.
- Findings cite code, trace evidence, screenshots, or clearly labeled assumptions.
- Recommendations are targeted, not generic "optimize everything" advice.
- Refactors preserve behavior unless requested otherwise.
- Profiling commands, trace path, binary path, load address, and confidence are reported when CLI profiling is used.
- The user gets a concrete verification plan.
1---2name: swiftui-dev3description: SwiftUI Dev4---56# SwiftUI Dev78Use this skill for SwiftUI development, architecture, structure, performance, and Apple native app profiling. It combines:910- SwiftUI view refactor and Observation/MV guidance.11- SwiftUI code-first performance audit.12- Native macOS/iOS Time Profiler CLI workflow with `xctrace`, `atos`, and included scripts.1314Do not use this skill for web performance, server profiling, generic PR review, product planning, or non-Apple UI frameworks. For ordinary implementation work without SwiftUI architecture/performance/native profiling concerns, use the development skill.1516## Route The Work1718| User intent | Read |19|---|---|20| Refactor SwiftUI View structure, split large `body`, review Observation / MV / ViewModel boundaries | `references/swiftui-refactor.md` |21| SwiftUI page is slow, scrolling janks, body updates too often, Instruments trace needs interpretation | `references/swiftui-performance.md` |22| Record/analyze macOS or iOS native Time Profiler traces from CLI, symbolicate and rank hotspots | `references/native-trace.md` |23| Need deeper Apple/WWDC context for SwiftUI update causes, hangs, Instruments lanes | Read the specific Apple summary files listed in the relevant reference |2425If the user provides only symptoms, start with code-first SwiftUI review. Ask for trace/screenshots only when code review is inconclusive or the user explicitly wants trace analysis.2627## Required Inputs2829For SwiftUI code review:3031- Target view or feature code.32- Data flow: `@State`, `@Binding`, `@Environment`, `@Observable`, `@Query`, services, models.33- Symptoms and reproduction steps.34- Device/OS/build configuration when performance is involved.3536For native profiling:3738- App name and binary path, or existing `.trace` bundle.39- Attach PID or launch binary path.40- Slow interaction to exercise during capture.41- Capture duration, defaulting to 90 seconds.42- Matching symbols / binary and permission to launch or attach.4344Proceed with explicit assumptions for code-only reviews. Stop before profiling if required tools or permissions are missing.4546## Core Workflow47481. **Classify the task**: SwiftUI structure/refactor, SwiftUI performance, or native trace profiling.492. **Start code-first for SwiftUI**: inspect structure, data flow, Observation ownership, identity, layout, and body work before requesting heavier tooling.503. **Use Instruments evidence when available**: treat traces/screenshots/CSV as evidence, not as the whole answer.514. **Make targeted recommendations**: order issues by likely impact and confidence.525. **Verify with the same scenario**: compare before/after CPU, frame drops, memory peak, sample counts, or the specific user-visible symptom when data exists.5354## Boundaries5556- Do not invent metrics, trace findings, sample counts, call stacks, device settings, or benchmark results.57- Do not run `xctrace` unless the user has provided a local target, trace, or explicit permission and the environment is macOS with Xcode tools.58- Do not interpret stale symbols as real hotspots. Binary, trace, and load address must match.59- Do not introduce ViewModels by default. Prefer SwiftUI-native state/data flow unless existing code or user requirements justify a view model.60- Do not change business logic during refactor unless the user explicitly asks.61- If source files must be edited, follow the existing project style and verify with relevant build/tests/profiling.6263## Output Format6465Use this concise structure unless a reference template is more specific:6667```markdown68# SwiftUI Dev Review: [Target]6970## Inputs And Assumptions7172## Findings73| Priority | Finding | Evidence | Recommendation | Confidence |74|---|---|---|---|---|7576## Suggested Changes7778## Verification Plan7980## Risks / Limits8182## Handoff To Next Stage83```8485For native trace analysis, use the report structure in `references/native-trace.md`.8687## Quality Checklist8889Before finalizing, verify:9091- The task is Apple-native or SwiftUI-specific.92- SwiftUI structure recommendations preserve clear data ownership and framework-native state flow.93- Findings cite code, trace evidence, screenshots, or clearly labeled assumptions.94- Recommendations are targeted, not generic "optimize everything" advice.95- Refactors preserve behavior unless requested otherwise.96- Profiling commands, trace path, binary path, load address, and confidence are reported when CLI profiling is used.97- The user gets a concrete verification plan.