swiftui-expert-skill

Reviews, writes, and profiles SwiftUI code using API references and Instruments trace analysis.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve? SwiftUI code often suffers from deprecated APIs, incorrect state management, unstable list identity, and performance issues like hangs and hitches that are hard to diagnose without structured guidance and profiling data. ## Core Features & Use Cases - Code Review and Refactoring: Audits SwiftUI code against a correctness checklist covering @State privacy, @Observable migration, ForEach identity, and deprecated API replacement across iOS 15 through iOS 26. - Topic-Routed Guidance: Routes tasks to 25+ reference documents covering state management, animations, charts, accessibility, localization, Liquid Glass, and macOS-specific patterns. - Instruments Trace Workflows: Records new .trace files via xctrace and analyzes existing ones to diagnose hangs, hitches, CPU hotspots, and excessive view updates with cause-graph fan-in analysis. - Use Case: A user provides a .trace file showing scroll hitches; the skill parses the trace, identifies the views being invalidated, traces the invalidation sources, and returns a prioritized fix plan citing specific evidence. ## Quick Start Ask the assistant to review your SwiftUI view file for deprecated APIs and performance issues, or provide an Instruments .trace file to analyze for hangs and excessive view updates.

Frequently Asked Questions about swiftui-expert-skill

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

FAQPage Schema
How do I find performance problems in my SwiftUI app?

Record an Instruments trace with the SwiftUI template on a real device, then analyze the .trace file to inspect hangs, hitches, and CPU hotspots. The analysis reveals which views update excessively and which sources drive the invalidation.

How do I migrate SwiftUI code to @Observable from ObservableObject?

On iOS 17+, replace @StateObject with @State holding an @Observable class, and use @Bindable for injected observables that need bindings. The state-management reference covers the full migration pattern and property wrapper rules.

Does the SwiftUI Instruments template work on the iOS Simulator?

No, the SwiftUI lane returns empty data on the iOS Simulator. Use the Time Profiler template instead, which still provides Time Profiler, Hangs, and Animation Hitches lanes. Real devices and the host Mac support the full SwiftUI template.

Why does my ForEach cause unexpected view updates in SwiftUI?

ForEach issues usually come from unstable identity, such as using .indices or offsets as IDs. Identity must outlive the view and not derive from mutable content, and each element should render a constant number of views.

When should I adopt Liquid Glass effects in SwiftUI?

Adopt Liquid Glass only when explicitly requested, since it requires iOS 26+. Gate the APIs with #available and provide fallback styling for earlier versions, following the patterns in the Liquid Glass reference.