agentsclimarketplace

Swiftui expert skill

Skill SwiftyJourney/swiftui-expert-skill

Write, review and improve SwiftUI: state, composition, performance, animations, accessibility and iOS 26 Liquid Glass - Agent Skill

Install
npx -y skills add SwiftyJourney/swiftui-expert-skill

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 3 stars3 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, accessibility, and modern APIs. Use when building SwiftUI features, refactoring views, reviewing code quality, or adopting modern SwiftUI patterns.

SKILL.md

11.9 KB, as published. Nobody here has run it

SwiftUI Expert Skill

Agent Behavior Contract

When this skill is active, follow these rules strictly:

  1. Focus on facts and best practices, not architecture — defer architectural decisions (MVVM, MVC, VIPER, Clean Architecture, Coordinator) to ios-architecture-expert.
  2. Always prefer @Observable over ObservableObject for new code. Mark @Observable classes with @MainActor unless using default actor isolation.
  3. Never use applyIf or generic conditional modifier helpers — they break view identity.
  4. Prefer modifiers over conditional views for state changes (preserves structural identity).
  5. Use modern APIs over deprecated equivalents — see references/modern-apis.md.
  6. Lead with corrected/improved code when reviewing; explain why a pattern is better (diffing, thread safety, API correctness).
  7. Use "prefer"/"avoid" for recommendations; "always"/"never" only for API correctness.
  8. Respond in the same language the user writes in — default to English when uncertain.
  9. Adopt Liquid Glass only when explicitly requested — glass is for controls and navigation only (HIG).
  10. Gate iOS 26+ features with #available and provide fallbacks.

Diagnostic Table

SymptomFirst checkSmallest fixDeep dive
Wrong property wrapper chosenOwnership directionMatch wrapper to data flowreferences/state-management.md
View re-renders too oftenDependency graphNarrow state dependenciesreferences/performance-patterns.md
Deprecated API warningAPI replacement tableSwap to modern equivalentreferences/modern-apis.md
View body is 200+ linesView extraction rulesExtract struct subviewsreferences/view-composition.md
ForEach flickers or reordersIdentity stabilityUse stable Identifiable IDreferences/list-patterns.md
Animation is janky or missingImplicit vs explicitMatch animation to state change sitereferences/animation-basics.md
Glass effect on wrong layerHIG complianceGlass on controls only, not contentreferences/liquid-glass.md
Custom control lacks accessibilitySemantic componentsUse Button/Label or accessibilityRepresentationreferences/accessibility-patterns.md
Tap/gesture not firing inside a scroll or listGesture precedenceUse highPriorityGesture/simultaneousGesturereferences/gestures.md
Async load leaks, re-fires, or janks the UITask lifecycle & isolation.task/.task(id:); offload heavy work with @concurrentreferences/data-loading-and-tasks.md
Need a layout stacks/grids can't expressLayout negotiationConform to the Layout protocolreferences/layout-protocol.md
App body won't compile or state leaks across windowsScene structureApp body returns some Scene; WindowGroup is per-windowreferences/app-lifecycle-and-scenes.md
Persisting settings or restoring per-scene statePersistence mechanism@AppStorage/@SceneStorage/SwiftData/PreferenceKeyreferences/data-persistence.md

Quick Summary

AreaKey PrincipleReference
State Management@Observable + @MainActor; @State for owned, @Binding for child-modifies-parentreferences/state-management.md
View CompositionSmall single-responsibility views; extract structs, not @ViewBuilder functionsreferences/view-composition.md
Modern APIsforegroundStyle, clipShape, NavigationStack, Tab, Button over onTapGesturereferences/modern-apis.md
PerformanceCheap inits, pure body, narrow dependencies, stable ForEach identityreferences/performance-patterns.md
AnimationswithAnimation for events, .animation(_:value:) for reactive, transforms over layoutreferences/animation-basics.md
AccessibilitySemantic fonts/styles, @ScaledMetric, accessibilityRepresentation for custom controlsreferences/accessibility-patterns.md
Liquid GlassControls/navigation only (HIG); Glass.regular default; GlassEffectContainer for groupsreferences/liquid-glass.md
Data Loading.task over .onAppear{Task{}}; .task(id:) for fetch-on-change; @concurrent to offload heavy workreferences/data-loading-and-tasks.md
Gestures@GestureState auto-reset; gesture precedence (highPriority/simultaneous); modern MagnifyGesture/RotateGesturereferences/gestures.md
LayoutParent proposes, child chooses, parent positions; custom Layout for bespoke arrangementsreferences/layout-protocol.md
App LifecycleApp body returns some Scene; WindowGroup per-window state; scenePhase read-site semanticsreferences/app-lifecycle-and-scenes.md
Persistence@AppStorage (global), @SceneStorage (per-scene), SwiftData wiring, PreferenceKey (child→parent)references/data-persistence.md

Quick Reference

Property Wrapper Selection

WrapperUse When
@StateInternal view state (must be private), or owned @Observable class
@BindingChild modifies parent's state
@BindableInjected @Observable needing bindings
letRead-only value from parent
varRead-only value watched via .onChange()

Full guide including legacy wrappers: state-management.md

Modern API Replacements

DeprecatedModern Alternative
foregroundColor()foregroundStyle()
cornerRadius()clipShape(.rect(cornerRadius:))
tabItem()Tab API (iOS 18+)
onTapGesture()Button (unless need location/count)
NavigationViewNavigationStack
onChange(of:) { value in }onChange(of:) { old, new in } or onChange(of:) { }
GeometryReadercontainerRelativeFrame() or visualEffect()
MagnificationGestureMagnifyGesture
RotationGestureRotateGesture

Full table: modern-apis.md


Workflow Decision Tree

1) Review existing SwiftUI code

  • Check property wrapper usage -> references/state-management.md
  • Verify modern API usage -> references/modern-apis.md
  • Verify view composition and extraction -> references/view-composition.md
  • Check performance patterns -> references/performance-patterns.md
  • Inspect accessibility and Liquid Glass -> references/accessibility-patterns.md, references/liquid-glass.md

2) Improve existing SwiftUI code

  • Audit state management (prefer @Observable over ObservableObject) -> references/state-management.md
  • Replace deprecated APIs -> references/modern-apis.md
  • Extract complex views into subviews -> references/view-composition.md
  • Optimize hot paths and list identity -> references/performance-patterns.md, references/list-patterns.md
  • Improve animations and accessibility -> references/animation-basics.md, references/accessibility-patterns.md

3) Implement new SwiftUI feature

  • Design data flow first: owned vs injected state -> references/state-management.md
  • Use modern APIs and @Observable -> references/modern-apis.md
  • Structure views for optimal diffing -> references/view-composition.md
  • Apply correct animation patterns -> references/animation-basics.md, references/animation-advanced.md
  • Add accessibility and glass effects (if requested) -> references/accessibility-patterns.md, references/liquid-glass.md

Guardrails

  • Do not enforce specific architectures (MVVM, MVC, VIPER) — defer to ios-architecture-expert
  • Do not use applyIf or conditional modifier helpers that break view identity
  • Do not declare passed values as @State or @StateObject — they only accept initial values
  • Do not create objects or start Tasks in view initializers or body
  • Do not use .indices for ForEach identity with dynamic content
  • Do not apply glass effects to content layer views — glass is for controls and navigation only (HIG)
  • Do not use AnyView in list rows
  • Do not use GeometryReader when containerRelativeFrame(), onGeometryChange, or visualEffect suffice

Verification Checklist

When implementing or reviewing SwiftUI code:

  1. Property wrappers match ownership direction (@State private, @Binding for modification, @Observable for shared)
  2. No deprecated APIs (foregroundColor, cornerRadius, NavigationView, tabItem)
  3. View body is pure — no side effects, no Task creation, no object allocation
  4. Complex views extracted into struct subviews (not @ViewBuilder functions)
  5. ForEach uses stable Identifiable identity (never .indices)
  6. Animations use value parameter or withAnimation (no deprecated parameterless .animation())
  7. Accessibility: semantic fonts, @ScaledMetric, Button over onTapGesture
  8. Liquid Glass (if present): #available gated, controls-only, GlassEffectContainer for groups
  9. No applyIf, no conditional modifier helpers, no if/else for style changes
  10. Views work in any context (no hardcoded sizes, no UIScreen.main.bounds)

Reference Router

Open the smallest reference that matches the question:

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.