Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, macOS-specific APIs, and iOS 26+ Liquid Glass adoption. Use when building new SwiftUI features, refactoring existing views, reviewing code quality, or adopting modern SwiftUI patterns.
Installer avec Codex ou Claude Copiez ce prompt, collez-le dans Codex, Claude ou un autre assistant, puis laissez-le vérifier la page du skill et l'installer pour vous.
Une commande directe contourne le prompt de vérification. Examinez la source avant de l'exécuter.
Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, macOS-specific APIs, and iOS 26+ Liquid Glass adoption. Use when building new SwiftUI features, refactoring existing views, reviewing code quality, or adopting modern SwiftUI patterns.
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
First, consult references/latest-apis.md to ensure only current, non-deprecated APIs are used
Check property wrapper usage against the selection guide (see references/state-management.md)
Verify view composition follows extraction rules (see references/view-structure.md)
Check performance patterns are applied (see references/performance-patterns.md)
Verify list patterns use stable identity (see references/list-patterns.md)
Check animation patterns for correctness (see references/animation-basics.md, references/animation-transitions.md)
Review accessibility: proper grouping, traits, Dynamic Type support (see references/accessibility-patterns.md)
Check chart patterns for correct mark usage, stable data identity, and availability gating (see references/charts.md; for accessibility and fallback strategies see references/charts-accessibility.md)
For macOS targets: verify correct use of macOS-specific APIs and patterns (see , , )
references/macos-scenes.md
references/macos-window-styling.md
references/macos-views.md
Inspect Liquid Glass usage for correctness and consistency (see references/liquid-glass.md)
Validate iOS 26+ availability handling with sensible fallbacks
2) Improve existing SwiftUI code
First, consult references/latest-apis.md to replace any deprecated APIs with their modern equivalents
Audit state management for correct wrapper selection (see references/state-management.md)
Extract complex views into separate subviews (see references/view-structure.md)
Refactor hot paths to minimize redundant state updates (see references/performance-patterns.md)
Ensure ForEach uses stable identity (see references/list-patterns.md)
Improve animation patterns (use value parameter, proper transitions, see references/animation-basics.md, references/animation-transitions.md)
Improve accessibility: use Button over tap gestures, add @ScaledMetric for Dynamic Type (see references/accessibility-patterns.md)
Review chart code for correct modifier scope, styling, and accessibility (see references/charts.md, references/charts-accessibility.md)
For macOS targets: adopt macOS-specific APIs (MenuBarExtra, Settings, Table, Commands, etc.) where appropriate (see references/macos-scenes.md, references/macos-window-styling.md, references/macos-views.md)
Suggest image downsampling when UIImage(data:) is used (as optional optimization, see references/image-optimization.md)
Adopt Liquid Glass only when explicitly requested by the user
3) Implement new SwiftUI feature
First, consult references/latest-apis.md to use only current, non-deprecated APIs for the target deployment version
Design data flow first: identify owned vs injected state (see references/state-management.md)
Structure views for optimal diffing (extract subviews early, see references/view-structure.md)
Keep business logic in services and models for testability (see references/layout-best-practices.md)
Use correct animation patterns (implicit vs explicit, transitions, see references/animation-basics.md, references/animation-transitions.md, references/animation-advanced.md)
Use Button for tappable elements, add accessibility grouping and labels (see references/accessibility-patterns.md)
For charts: use correct mark types, stable data identity, and gate iOS 17+/18+/26+ APIs (see references/charts.md; for accessibility see references/charts-accessibility.md)
For macOS targets: use macOS-specific scenes (see references/macos-scenes.md), window styling (see references/macos-window-styling.md), and views like HSplitView, Table (see references/macos-views.md)
Apply glass effects after layout/appearance modifiers (see references/liquid-glass.md)
Gate iOS 26+ features with #available and provide fallbacks
Core Guidelines
State Management
@State must be private; use for internal view state
@Binding only when a child needs to modify parent state
@StateObject when view creates the object; @ObservedObject when injected
iOS 17+: Use @State with @Observable classes; use @Bindable for injected observables needing bindings
Use let for read-only values; var + .onChange() for reactive reads
Never pass values into @State or @StateObject — they only accept initial values
Animations (see references/animation-basics.md, references/animation-transitions.md, references/animation-advanced.md)
Using .animation(_:value:) with value parameter
Using withAnimation for event-driven animations
Transitions paired with animations outside conditional structure
Custom Animatable has explicit animatableData (or @Animatable macro on iOS 26+)
Preferring transforms over layout changes for animation performance
Phase animations for multi-step sequences (iOS 17+)
Keyframe animations for precise timing (iOS 17+)
Completion handlers use .transaction(value:) for reexecution
Accessibility (see references/accessibility-patterns.md)
Button used instead of onTapGesture for tappable elements
@ScaledMetric used for custom values that should scale with Dynamic Type
Related elements grouped with accessibilityElement(children:)
Custom controls use accessibilityRepresentation when appropriate
Charts (see references/charts.md, references/charts-accessibility.md)
import Charts is present in files using chart types
Chart data models use Identifiable (or explicit id: key path)
Chart-wide modifiers applied to Chart, not individual marks
iOS 17+ APIs (SectorMark, selection, scrollable axes) are availability-gated
iOS 18+ APIs (plot types like LinePlot, AreaPlot) are availability-gated
iOS 26+ APIs (Chart3D, SurfacePlot) are availability-gated
Meaningful .value() labels used for axes and accessibility
foregroundStyle(by:) used for categorical series (not manual per-mark colors)
macOS APIs (see references/macos-scenes.md, references/macos-window-styling.md, references/macos-views.md)
Using Settings scene for preferences (not a custom window)
Using MenuBarExtra for menu bar items (not AppKit NSStatusItem)
Using Commands / CommandGroup / CommandMenu for menu bar menus
Table adapts for compact size classes on iOS (first column shows combined info)
Window sizing configured with defaultSize, windowResizability, and frame(minWidth:minHeight:)
macOS-only code wrapped in #if os(macOS) conditionals
Using NSViewRepresentable with proper makeNSView/updateNSView lifecycle
Using NavigationSplitView (not HSplitView) for sidebar-based navigation
HSplitView/VSplitView reserved for IDE-style equal peer panes
Liquid Glass (iOS 26+)
#available(iOS 26, *) with fallback for Liquid Glass
Multiple glass views wrapped in GlassEffectContainer
.glassEffect() applied after layout/appearance modifiers
.interactive() only on user-interactable elements
Shapes and tints consistent across related elements
References
references/latest-apis.md - Required reading for all workflows. Version-segmented guide of deprecated-to-modern API transitions (iOS 15+ through iOS 26+)
references/state-management.md - Property wrappers and data flow
references/view-structure.md - View composition, extraction, and container patterns
references/performance-patterns.md - Performance optimization techniques and anti-patterns
references/list-patterns.md - ForEach identity, stability, Table (iOS 16+), and list best practices
references/layout-best-practices.md - Layout patterns, context-agnostic views, and testability
references/accessibility-patterns.md - Accessibility traits, grouping, Dynamic Type, and VoiceOver