swiftui-expert-skill

Write, review, and improve SwiftUI code following modern API and state management best practices.

70|4|Updated Jul 22, 2025
One-click install
npx skills add https://github.com/AlexW00/Zettel --skill swiftui-expert-skill-alexw00
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: swiftui-expert-skill
Source: https://github.com/AlexW00/Zettel/tree/main/.agents/skills/swiftui-expert-skill
Command: npx skills add https://github.com/AlexW00/Zettel --skill swiftui-expert-skill-alexw00

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? SwiftUI codebases often accumulate deprecated APIs, incorrect property wrapper usage, unstable list identities, and performance anti-patterns that cause broken animations, excessive view updates, and hard-to-test logic. This Skill provides structured guidance and checklists to write, review, and refactor SwiftUI code correctly. ## Core Features & Use Cases - State Management Guidance: Enforces correct property wrapper selection, preferring @Observable over ObservableObject, private @State, and proper @Binding/@Bindable usage. - Modern API Migration: Replaces deprecated modifiers like foregroundColor(), cornerRadius(), NavigationView, and tabItem() with their modern equivalents. - Performance & Animation Review: Applies checklists for stable ForEach identity, lazy stacks, transform-based animations, transitions, and iOS 17+ phase/keyframe animators. - iOS 26 Liquid Glass Adoption: Guides correct usage of glassEffect, GlassEffectContainer, and glass button styles with availability fallbacks, only when explicitly requested. - Use Case: When refactoring a SwiftUI view that uses ObservableObject and deprecated modifiers, the Skill audits the code against its references and produces a modernized, performant implementation. ## Quick Start Ask the assistant to review your SwiftUI view for state management, modern API usage, and performance issues using this skill.

Frequently Asked Questions about swiftui-expert-skill

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

FAQPage Schema
How do I choose between @State, @Binding, and @Observable in SwiftUI?▼

Use @State for private internal view state or owned @Observable classes, @Binding when a child must modify parent state, and @Bindable for injected @Observable objects needing bindings. Prefer @Observable over ObservableObject for all new code.

What are the modern replacements for deprecated SwiftUI modifiers?▼

Replace foregroundColor() with foregroundStyle(), cornerRadius() with clipShape(.rect(cornerRadius:)), NavigationView with NavigationStack, and tabItem() with the Tab API. Use the two-parameter or no-parameter onChange variant instead of the single-parameter form.

Why does my SwiftUI ForEach cause broken animations or crashes?▼

ForEach issues typically come from unstable identity, such as using .indices for dynamic content or inline filtering. Always provide stable identity via Identifiable or a stable keypath, keep a constant number of views per element, and prefilter data outside the ForEach.

How do I adopt iOS 26 Liquid Glass effects in SwiftUI?▼

Apply .glassEffect() after layout and appearance modifiers, wrap multiple glass elements in a GlassEffectContainer, and use .interactive() only on tappable elements. Gate usage with #available(iOS 26, *) and provide a fallback such as .ultraThinMaterial.

When should I use phaseAnimator versus keyframeAnimator in SwiftUI?▼

Use phaseAnimator (iOS 17+) for multi-step sequences that cycle through discrete phases, and keyframeAnimator for precise timing control with exact values at specific times. Both replace error-prone manual DispatchQueue timing chains.

Does this skill enforce a specific architecture like MVVM?▼

No, the skill focuses on facts and best practices rather than architectural opinions. It encourages separating business logic into testable models but does not enforce MVVM, VIPER, or any specific pattern.