swiftui-performance-audit

Diagnose SwiftUI rendering, scrolling, and memory performance issues from code review and Instruments traces.

Updated Mar 12, 2026
One-click install
npx skills add https://github.com/RavitejaKarra24/dotfiles --skill swiftui-performance-audit-ravitejakarra24
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftui-performance-audit
Source: https://github.com/RavitejaKarra24/dotfiles/tree/main/agents/.agents/skills/swiftui-performance-audit
Command: npx skills add https://github.com/RavitejaKarra24/dotfiles --skill swiftui-performance-audit-ravitejakarra24

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? SwiftUI apps often suffer from janky scrolling, excessive view updates, high CPU or memory usage, and hangs that are hard to trace back to specific code. This Skill provides a structured audit workflow that classifies the symptom, reviews the code for known performance smells, and guides you through Instruments profiling when code review alone cannot explain the issue. ## Core Features & Use Cases - Code-first review: Detects common SwiftUI performance smells such as expensive formatters in body, unstable ForEach identity, inline filtering, broad @Observable fan-out, and main-thread image decoding, with concrete remediation patterns. - Guided profiling intake: Provides a checklist for capturing SwiftUI Instruments traces, Time Profiler call trees, and hang data on the correct device and build configuration. - Structured audit reports: Produces findings ordered by impact with symptoms, evidence, fixes, validation steps, and before/after metrics tables. - Use Case: A user reports dropped frames when scrolling a list. The Skill identifies inline filtering inside ForEach and unstable identity as likely causes, suggests pre-filtering with stable IDs, and requests a Release-mode SwiftUI trace to confirm the fix. ## Quick Start Ask the assistant to audit your SwiftUI view for performance problems and paste the relevant view code along with a description of the symptom.

Frequently Asked Questions about swiftui-performance-audit

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix janky scrolling in a SwiftUI List?

Janky scrolling usually comes from unstable identity or heavy work in `body`. Use stable domain identifiers instead of `id: \.self`, pre-filter and pre-sort collections before rendering, and move formatting or image decoding off the main thread.

How to profile SwiftUI performance with Instruments?

Profile a Release build on a real device using the SwiftUI Instruments template, which combines the SwiftUI timeline with Time Profiler. Inspect Long View Body Updates, correlate with the Time Profiler call tree, and use the Cause and Effect Graph to find what triggers updates.

Why does my SwiftUI view update too often?

Excessive updates typically come from broad observation, such as many views reading a shared `@Observable` collection or environment value. Narrow the observable surface, scope state closer to leaf views, and use `Self._printChanges()` in debug builds to inspect dependencies.

When should I use equatable() on a SwiftUI view?

Use `equatable()` only when the equality check is cheaper than recomputing the subtree and the view inputs are value-semantic and stable. It is not a blanket fix for redraws and can add overhead if equality checks are expensive.

Can SwiftUI performance issues be diagnosed without Instruments?

Many issues can be found through code review alone, such as formatters created in `body`, inline filtering in `ForEach`, and main-thread image decoding. Profiling is requested only when code review cannot explain the symptom or runtime evidence is needed.

Why do SwiftUI traces look different in Debug builds or the Simulator?

Debug builds distort SwiftUI timing and allocation behavior, and the Simulator can miss device-only rendering and memory issues. Always capture traces in Release configuration on a physical device for reliable measurements.