swiftui-expert-skill

Write, review, and refactor SwiftUI code following current Apple API best practices.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? SwiftUI evolves rapidly across iOS releases, making it easy to ship deprecated APIs, broken state management, or accessibility gaps. This Skill guides writing, reviewing, and improving SwiftUI code against current best practices for state management, view composition, performance, macOS APIs, and iOS 26+ Liquid Glass adoption. ## Core Features & Use Cases - Code Review & Refactoring: Audit existing SwiftUI views against a correctness checklist covering @State privacy, ForEach identity, animation value parameters, and #available gating. - Topic-Routed References: Consult 20 focused reference files covering state management, animations, charts, accessibility, focus, scroll patterns, and macOS-specific scenes and window styling. - Deprecated API Migration: Replace deprecated APIs with modern equivalents using a lookup table spanning iOS 15 through iOS 26, including @Observable migration and Liquid Glass adoption. - Use Case: When reviewing a SwiftUI view that uses NavigationView and onChange(of:perform:), the Skill flags both as deprecated and provides the NavigationStack and modern onChange replacements with correct code samples. ## Quick Start Ask the assistant to review your SwiftUI view file for deprecated APIs, state management issues, and performance improvements.

Frequently Asked Questions about swiftui-expert-skill

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

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

On iOS 17+, replace ObservableObject classes with the @Observable macro, use @State instead of @StateObject for view-owned objects, and use @Bindable instead of @ObservedObject for injected observables that need bindings. The state-management reference covers full migration patterns.

How do I review SwiftUI code for deprecated APIs?

Compare the code against the latest-apis reference, which maps deprecated APIs to modern replacements from iOS 15 through iOS 26. Common flags include NavigationView, onChange(of:perform:), foregroundColor, and animation modifiers missing the value parameter.

Does SwiftUI support the iOS 26 Liquid Glass design?

Yes, iOS 26 adds Liquid Glass APIs including glassEffect, GlassEffectContainer, and glass button styles. These must be gated with #available(iOS 26, *) and paired with fallback styling for earlier OS versions.

Why does my SwiftUI animation not fire on view removal?

Transitions require an animation context outside the conditional. Placing .animation inside the if branch removes it with the view, so the removal transition is skipped. Use withAnimation on the state change or place .animation(_:value:) outside the conditional.

When should I use @StateObject versus @ObservedObject?

Use @StateObject when the view creates and owns the object, and @ObservedObject when the object is injected from a parent. Declaring passed-in objects as @StateObject or @State is a bug because they ignore updates from the source.