# Swiftui Performance Audit

SwiftUI performance: render, scroll, CPU/memory, updates, layout, Instruments.

- Repository: https://github.com/steipete/agent-scripts (7431 stars)
- Category: Mobile
- License: MIT
- Last updated: 2026-10-30
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add steipete/agent-scripts --skill swiftui-performance-audit -g -a claude-code -y`
Codex: `npx skills add steipete/agent-scripts --skill swiftui-performance-audit -g -a codex -y`
Cursor: `npx skills add steipete/agent-scripts --skill swiftui-performance-audit -g -a cursor -y`
Gemini CLI: `npx skills add steipete/agent-scripts --skill swiftui-performance-audit -g -a gemini-cli -y`

## Description

SwiftUI performance: render, scroll, CPU/memory, updates, layout, Instruments.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# SwiftUI Performance Audit

_Attribution: copied from @Dimillian’s `Dimillian/Skills` (2025-12-31)._

## Overview

Audit SwiftUI view performance end-to-end, from instrumentation and baselining to root-cause analysis and concrete remediation steps.

## Workflow Decision Tree

- If the user provides code, start with "Code-First Review."
- If the user only describes symptoms, ask for minimal code/context, then do "Code-First Review."
- If code review is inconclusive, go to "Guide the User to Profile" and ask for a trace or screenshots.

## 1. Code-First Review

Collect:
- Target view/feature code.
- Data flow: state, environment, observable models.
- Symptoms and reproduction steps.

Focus on:
- View invalidation storms from broad state changes.
- Unstable identity in lists (`id` churn, `UUID()` per render).
- Heavy work in `body` (formatting, sorting, image decoding).
- Layout thrash (deep stacks, `GeometryReader`, preference chains).
- Large images without downsampling or resizing.
- Over-animated hierarchies (implicit animations on large trees).

Provide:
- Likely root causes with code references.
- Suggested fixes and refactors.
- If needed, a minimal repro or instrumentation suggestion.

## 2. Guide the User to Profile

Explain how to collect data with Instruments:
- Use the SwiftUI template in Instruments (Release build).
- Reproduce the exact interaction (scroll, navigation, animation).
- Capture SwiftUI timeline and Time Profiler.
- Export or screenshot the relevant lanes and the call tree.

Ask for:
- Trace export or screenshots of SwiftUI lanes + Time Profiler call tree.
- Device/OS/build configuration.

## 3. Analyze and Diagnose

The rest: https://github.com/steipete/agent-scripts/blob/HEAD/skills/swiftui-performance-audit/SKILL.md
