Swiftui expert skill

From hainamchung/agent-assistant · View interactive version

Swiftui expert skill is an AI agent skill from the GitHub repository hainamchung/agent-assistant. Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, and iOS 26+ Liquid Glass adoption. Use when building new SwiftUI features, refactoring existing views, reviewing code quality, or adopting modern SwiftUI patterns.

How to use this skill

Skill file

SwiftUI Expert Skill

Overview

Use this skill to build, review, or improve SwiftUI features with correct state management, optimal view composition, and iOS 26+ Liquid Glass styling. Prioritize native APIs, Apple design guidance, and performance-conscious patterns. This skill focuses on facts and best practices without enforcing specific architectural patterns.

Workflow Decision Tree

1) Review existing SwiftUI code

2) Improve existing SwiftUI code

3) Implement new SwiftUI feature

Core Guidelines

State Management

View Composition

Performance

Animations

Accessibility

Liquid Glass (iOS 26+)

Only adopt when explicitly requested by the user.

Quick Reference

Property Wrapper Selection

| Wrapper | Use When |

|---------|----------|

| @State | Internal view state (must be private) |

| @Binding | Child modifies parent's state |

| @StateObject | View owns an ObservableObject |

| @ObservedObject | View receives an ObservableObject |

| @Bindable | iOS 17+: Injected @Observable needing bindings |

| let | Read-only value from parent |

| var | Read-only value watched via .onChange() |

Liquid Glass Patterns

// Basic glass effect with fallback
if #available(iOS 26, *) {
    content
        .padding()
        .glassEffect(.regular.interactive(), in: .rect(cornerRadius: 16))
} else {
    content
        .padding()
        .background(.ultraThinMaterial, in: RoundedRectangle(cornerRadius: 16))
}

// Grouped glass elements
GlassEffectContainer(spacing: 24) {
    HStack(spacing: 24) {
        GlassButton1()
        GlassButton2()
    }
}

// Glass buttons
Button("Confirm") { }
    .buttonStyle(.glassProminent)

Review Checklist

Latest APIs (see `references/latest-apis.md`)

State Management

Sheets & Navigation (see `references/sheet-navigation-patterns.md`)

ScrollView (see `references/scroll-patterns.md`)

View Structure (see `references/view-structure.md`)

Performance (see `references/performance-patterns.md`)

List Patterns (see `references/list-patterns.md`)

Layout (see `references/layout-best-practices.md`)

Animations (see `references/animation-basics.md`, `references/animation-transitions.md`, `references/animation-advanced.md`)

Accessibility (see `references/accessibility-patterns.md`)

Liquid Glass (iOS 26+)

References

Philosophy

This skill focuses on facts and best practices, not architectural opinions:

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.