swiftui-performance-developer

Audit SwiftUI code for rendering bottlenecks and guide Instruments profiling workflows.

514|79|Updated May 26, 2023
One-click install
npx skills add https://github.com/anyproto/anytype-swift --skill swiftui-performance-developer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftui-performance-developer
Source: https://github.com/anyproto/anytype-swift/tree/main/.claude/skills/swiftui-performance-developer
Command: npx skills add https://github.com/anyproto/anytype-swift --skill swiftui-performance-developer

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

SwiftUI apps often suffer from janky scrolling, slow rendering, excessive view updates, and layout thrash that are hard to diagnose without a structured approach. This Skill provides a code-first review workflow for common SwiftUI performance anti-patterns and escalates to Instruments profiling guidance when code review is inconclusive.

Core Features & Use Cases

  • Code-First Performance Review: Detects view invalidation storms, unstable list identity, heavy work in view bodies, inline sorting/filtering in ForEach, and undownsampled images.
  • Instruments Profiling Guidance: Walks through recording with the SwiftUI template, reading Long View Body Updates and Hitches lanes, and correlating with Time Profiler.
  • WWDC-Grounded References: Includes distilled guidance from WWDC23 Demystify SwiftUI Performance and Apple Instruments documentation, including _printChanges() debugging and constant view count patterns.
  • Use Case: A user reports a stuttering List in their iOS app. The Skill reviews the ForEach code, finds id: \.self on unstable values and an inline .filter, then recommends stable IDs and a pre-filtered cached collection.

Quick Start

Ask the assistant to review your SwiftUI view code for performance issues causing slow scrolling or excessive view updates.

Frequently Asked Questions about swiftui-performance-developer

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

FAQPage Schema
How do I fix slow SwiftUI List scrolling performance?

Slow SwiftUI List scrolling usually comes from unstable identity, variable view counts per row, or heavy work in body. Use stable IDs like `id: \.id` instead of `\.self`, pre-filter collections instead of inline filtering, and avoid AnyView in rows.

How to profile SwiftUI performance with Instruments?

Profile via Product > Profile using the SwiftUI template in Release mode, reproduce the slow interaction, then inspect Long View Body Updates (orange over 500us, red over 1000us) and the Hitches lane. Correlate long updates with Time Profiler to find expensive frames.

Why does my SwiftUI view keep re-rendering unnecessarily?

Excessive re-rendering happens when views depend on broad state that changes frequently. Use `Self._printChanges()` in debug builds to see which dependencies trigger updates, then narrow state scope with @Observable or extract subviews that read only the data they need.

Does splitting SwiftUI views into subviews hurt performance?

No, splitting SwiftUI views into subviews does not hurt performance because views are lightweight value types describing UI state. SwiftUI only re-evaluates subviews whose dependencies actually changed, so decomposition often improves update granularity.

What causes layout thrash in SwiftUI apps?

Layout thrash commonly comes from GeometryReader placed deep in the view tree, fast-changing environment values, or state that forces repeated layout passes. Move geometry reads higher in the hierarchy, use fixed sizing where possible, and gate frequent updates behind thresholds.