swiftui-expert-skill

Review SwiftUI code for state management and modern API adherence.

8|2|Updated Dec 29, 2025
One-click install
npx skills add https://github.com/hack-dance/hack --skill swiftui-expert-skill-hack-dance
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftui-expert-skill
Source: https://github.com/hack-dance/hack/tree/main/.agents/skills/swiftui-expert-skill
Command: npx skills add https://github.com/hack-dance/hack --skill swiftui-expert-skill-hack-dance

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers write, review, and improve SwiftUI code by enforcing best practices for state management, view composition, performance, and modern API usage. It ensures code is maintainable, performant, and up-to-date with the latest Apple guidelines.

Core Features & Use Cases

  • Code Review: Audits existing SwiftUI code for adherence to modern patterns and best practices.
  • Code Improvement: Suggests refactoring for state management, performance, and API usage.
  • New Feature Implementation: Guides the creation of new SwiftUI features following optimal patterns.
  • Use Case: A developer is unsure whether to use @State or @StateObject for a new piece of UI state. They can consult this Skill to get a clear recommendation based on the latest SwiftUI guidelines.

Quick Start

Review the provided SwiftUI code snippet for adherence to modern state management patterns.

Frequently Asked Questions about swiftui-expert-skill

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

FAQPage Schema
When should I use @State vs @StateObject for SwiftUI state management?

Use @State for simple value-type UI state owned by the current view, while @StateObject initializes external reference-type models. For modern SwiftUI state management, this Skill recommends adopting the @Observable macro over @StateObject to ensure optimal performance and proper view lifecycle bindings.

How do I optimize SwiftUI performance for complex view hierarchies?

Optimize SwiftUI performance by reducing unnecessary view body recalculations, enforcing proper state management boundaries, and adopting modern APIs. This Skill audits view composition to identify expensive redraws and suggests refactoring code to isolate state dependencies and leverage SwiftUI's built-in diffing efficiently.

What are the best practices for SwiftUI code review and view composition?

SwiftUI code review best practices involve checking for proper state management, modular view composition, and modern API adoption. This Skill enforces guidelines by auditing existing code to ensure maintainable view hierarchies, correct Swift concurrency usage, and adherence to the latest Apple development recommendations.

Does this SwiftUI guidance cover modern iOS features like Liquid Glass?

Yes, this SwiftUI guidance covers modern iOS features like Liquid Glass. It enforces best practices for modern API adoption, ensuring your iOS development codebase integrates the latest Apple interface guidelines and Swift concurrency patterns correctly for optimal performance and maintainability.

How do I refactor legacy SwiftUI code to use Swift concurrency effectively?

Refactor legacy SwiftUI code to use Swift concurrency by migrating to modern property wrappers like @Observable and adopting structured concurrency patterns. This Skill provides expert guidance on updating state management and view composition to align with current Apple frameworks and eliminate outdated async patterns.

What are the limitations of using @Observable in SwiftUI state management?

A limitation of @Observable in SwiftUI state management is its requirement for iOS 17 or later, making it unsuitable for older deployment targets. When targeting older iOS versions, this Skill guides you to fall back to @StateObject or @ObservedObject to maintain compatibility without breaking performance.