app-store
App Store optimization and marketing skills for descriptions, screenshots, keywords, review responses, and comprehensive promotional strategy. Use when user…
Diagnose SwiftUI performance issues including unnecessary re-renders, view identity problems, and slow body evaluations. Use when SwiftUI views are slow, janky, or re-rendering too often.
$ npx -y skills add rshankras/claude-code-apple-skills --skill swiftui-debugging --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
/swiftui-debuggingContext preview
The summary Claude sees to decide when to auto-load this skill.
Diagnose SwiftUI performance issues including unnecessary re-renders, view identity problems, and slow body evaluations. Use when SwiftUI views are slow, janky, or re-rendering too often.
name: swiftui-debugging description: Diagnose SwiftUI performance issues including unnecessary re-renders, view identity problems, and slow body evaluations. Use when SwiftUI views are slow, janky, or re-rendering too often. allowed-tools: [Read, Glob, Grep] last_verified: 2026-07-16 review_by: 2027-06-22 os_version: iOS 27 / macOS 27
Systematic guide for diagnosing and fixing SwiftUI performance problems: unnecessary view re-evaluations, identity issues, expensive body computations, and lazy loading mistakes.
Use this skill when the user:
Every investigation follows the same loop: **symptom -> measure -> identify -> optimize -> RE-MEASURE**. The last step is the one people skip -- an "optimization" that was never re-measured is a guess, and SwiftUI guesses are wrong often enough (a fix can shift cost elsewhere) that the loop is not optional. Never close a performance issue on the strength of the diff alone.
What SwiftUI performance problem are you seeing? | +- Views re-render when they should not | +- Read body-reevaluation.md | +- Self._printChanges() to identify which property changed | +- @Observable vs ObservableObject observation differences | +- Splitting views to narrow observation scope | +- Scrolling is slow / choppy (lists, grids) | +- Read lazy-loading.md | +- VStack vs LazyVStack, ForEach without lazy container | +- List prefetching, grid cell reuse | +- Views lose state unexpectedly / animate when they should not | +- Read view-identity.md | +- Structural vs explicit identity | +- .id() misuse, conditional view branching | +- Known pitfall (AnyView, DateFormatter in body, etc.) | +- Read common-pitfalls.md | +- AnyView type erasure, object creation in body | +- Over-observation, expensive computations | +- General "my SwiftUI app is slow" (unknown cause) | +- Start with body-reevaluation.md, then common-pitfalls.md | +- Use Instruments SwiftUI template (see Debugging Tools below)
| API / Technique | Minimum Version | Reference | |----------------|-----------------|-----------| | `Self._printChanges()` | iOS 15 | body-reevaluation.md | | `@Observable` | iOS 17 / macOS 14 | body-reevaluation.md | | `@ObservableObject` | iOS 13 | body-reevaluation.md | | `LazyVStack` / `LazyHStack` | iOS 14 | lazy-loading.md | | `LazyVGrid` / `LazyHGrid` | iOS 14 | lazy-loading.md | | `.id()` modifier | iOS 13 | view-identity.md | | Instruments SwiftUI template | Xcode 14+ | SKILL.md | | Redesigned SwiftUI instrument | Xcode 26 / Instruments 26 | SKILL.md | | `os_signpost` | iOS 12 | SKILL.md |
| # | Mistake | Fix | Details | |---|---------|-----|---------| | 1 | Large `ForEach` inside `VStack` or `ScrollView` without lazy container | Wrap in `LazyVStack` -- eager `VStack` creates all views upfront | lazy-loading.md | | 2 | Using `AnyView` to erase types | Use `@ViewBuilder`, `Group`, or concrete generic types -- `AnyView` defeats diffing | common-pitfalls.md | | 3 | Creating objects in `body` (`DateFormatter()`, `NumberFormatter()`) | Use `static let` shared instances or `@State` for mutable objects | common-pitfalls.md | | 4 | Observing entire model when only one property is needed | Split into smaller `@Observable` objects or extract subviews | body-reevaluation.md | | 5 | Unstable `.id()` values causing full view recreation every render | Use stable identifiers (database IDs, UUIDs), never array indices or random values | view-identity.md |
`List` and `Table` gather **all identifiers eagerly** at load -- even though row *views* are lazy. Cheap, precomputed IDs mean fast loads; an `id:` key path that computes or hashes something expensive runs for every element before anything renders.
**The row-count equation:** rows = elements x views-per-element, and views-per-element must be a **constant** the framework can read without executing your closures.
When a body or update shows up slow in the profile, it is almost always one of these:
1. **Expensive dynamic-property initialization** -- e.g. a `@StateObject`/`@State` object doing I/O in its initializer 2. **Work in `body`** -- string interpolation/formatting, sorting, filtering 3. **Heap allocations in `body`** -- formatters, predicates, intermediate arrays 4. **Bundle/resource lookups in `body`** -- `Bundle.main` searches, decoding images synchronously
Move loading and expensive derivation to `.task` (or the model), then re-measure.
**Scope dependencies tightly -- but not obsessively.** Pass the child view the `Image` it renders, not the whole model object, so unrelated model changes stop invalidating it. Don't over-rotate: splitting a huge struct into dozens of single-property parameters costs mo
A collection of Claude Code skills for iOS, macOS, watchOS, visionOS, and Apple platform development. These skills help you plan and build apps, maintain code quality, ensure HIG compliance, and guide you from idea to App Store.
Repo: rshankras/claude-code-apple-skills
App Store optimization and marketing skills for descriptions, screenshots, keywords, review responses, and comprehensive promotional strategy. Use when user…
Privacy-preserving ad measurement with AdAttributionKit (SKAdNetwork's successor) — install and re-engagement attribution, conversion-value strategy under…
Generate compelling App Store descriptions that convert browsers into users. Use when writing initial descriptions, improving existing copy, or drafting…
Apple Search Ads campaign strategy for indie developers — paid acquisition, keyword bidding, budget planning, and ROAS optimization. Use when user asks about…
Take a one-time in-app purchase from MISSING_METADATA to READY_TO_SUBMIT in App Store Connect — set its price schedule and localized display name/description…
Optimize app title, subtitle, and keywords for maximum App Store discoverability. Use when launching a new app, improving search rankings, entering new…