swiftui-expert-skill
Skill430 starsChanged 6 months agoMITView on GitHub
Write, review, or improve SwiftUI code following best practices for state management, view composition, performance, modern APIs, Swift concurrency, and iOS 26+ Liquid Glass adoption. Use when building new SwiftUI features, refactoring existing views, reviewing code quality, or adopting modern SwiftUI patterns.
24 other projects use a version of this, 14 of them edited.
Adopted by
Most recently taken up by
- taixuann/development-spacetheir own version, first seen Nov 8, 2026
- tornikegomareli/Skillstheir own version, first seen Nov 8, 2026
- uinaf/slopwaketheir own version, first seen Nov 3, 2026
- The-Artificer-of-Ciphers-LLC/skills-from-the-artificertheir own version, first seen Nov 1, 2026
- deonmenezes/mobile-app-skilltheir own version, first seen Nov 1, 2026
- omega1119/groundworktheir own version, first seen Oct 20, 2026
Used with
Projects with it also use swiftui-pro and swiftui-liquid-glass.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
kingsidharthSkillswiftui-pro
Comprehensively reviews SwiftUI code for best practices on modern APIs, maintainability, and performance. Use when reading, writing, or reviewing SwiftUI projects.
Also in 5 projects that use this
OpenAISkillswiftui-liquid-glass
Implement and review iOS 26+ SwiftUI Liquid Glass UI. Use when adopting Liquid Glass or checking its correctness, performance, and design fit.
Also in 4 projects that use this
Other versions24 projects use a version of this.
Word for word · 0
None found.
Edited · 14
- Provenance-Emu/Provenance★ 6.4k50% same
- pablopunk/SwiftShift★ 66414% same
- anyproto/anytype-swift★ 52550% same
- sledtools/pika★ 4549% same
- nonameplum/agent-skills★ 1799% same
- xfstudio/skills★ 995% same
- tenondecrpc/tempo-for-claude★ 414% same
- ai4brands-design/claude-skills★ 295% same
- ronrefael/sonde★ 269% same
- shashwattrili/reclaude★ 214% same
4 more not listed
Wrote their own version · 10
- AvdLee/SwiftUI-Agent-Skill★ 3.9ksame name
- omarshahine/HomeClaw★ 191same name
- RubenGlez/lokalite★ 7same name
- The-Artificer-of-Ciphers-LLC/skills-from-the-artificer★ 6same name
- deonmenezes/mobile-app-skill★ 4same name
- tornikegomareli/Skills★ 2same name
- taixuann/development-space★ 1same name
- hebertzhu/agent-foundry★ 0same name
- omega1119/groundwork★ 0same name
- uinaf/slopwake★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- AGENTS.mdAGENTS.md
- macos/AGENTS.mdAGENTS.md
- sandbox-vm/AGENTS.mdAGENTS.md
- web/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- macos/CLAUDE.mdCLAUDE.md
- sandbox-vm/CLAUDE.mdCLAUDE.md
- app-store-changelogSkill
- bridge-agent-log-analyzerSkill
- gh-issue-fix-flowSkill
- githubSkill
- react-component-performanceSkill
- swift-concurrency-expertSkill
- swift-concurrencySkill
- swift-testing-expertSkill
- swiftui-performance-auditSkill
- swiftui-ui-patternsSkill
- swiftui-view-refactorSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
50 rules. 0 are common, 4 are distinctive, and 46 are very specific to this project.
0
Common
Most of the 24 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
46
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
Check property wrapper usage against the selection guide (see references/state-management.md)
- Very specific: line 15
Verify modern API usage (see references/modern-apis.md)
- Very specific: line 16
Verify view composition follows extraction rules (see references/view-structure.md)
- Very specific: line 17
Check performance patterns are applied (see references/performance-patterns.md)
- Very specific: line 18
Verify list patterns use stable identity (see references/list-patterns.md)
- Very specific: line 19
Check animation patterns for correctness (see references/animation-basics.md, references/animation-transitions.md)
- Very specific: line 28
Ensure ForEach uses stable identity (see references/list-patterns.md)
- Very specific: line 35
Use modern APIs (no deprecated modifiers or patterns, see references/modern-apis.md)
- Very specific: line 36
Use @Observable for shared state (with @MainActor if not using default actor isolation)
- Very specific: line 39
Use correct animation patterns (implicit vs explicit, transitions, see references/animation-basics.md, references/animation-transitions.md, …
- Very specific: line 50
Use @State with @Observable classes (not @StateObject)
- Very specific: line 53
Use let for read-only values.
- Very specific: line 58
Use foregroundStyle() instead of foregroundColor()
- Very specific: line 60
Use Tab API instead of tabItem()
- Very specific: line 61
Use Button instead of onTapGesture() (unless need location/count)
- Very specific: line 63
Use navigationDestination(for:) for type-safe navigation
- Very specific: line 64
Use two-parameter or no-parameter onChange() variant
- Very specific: line 65
Use ImageRenderer for rendering SwiftUI views
- Very specific: line 66
Use .sheet(item:) instead of .sheet(isPresented:) for model-based content
- Very specific: line 68
Use ScrollViewReader for programmatic scrolling with stable IDs
- Very specific: line 69
Avoid UIScreen.main.bounds for sizing
- Very specific: line 70
Avoid GeometryReader when alternatives exist (e.g., containerRelativeFrame())
- Very specific: line 73
Use modern Text formatting (.format parameters, not String(format:))
- Very specific: line 74
Use localizedStandardContains() for user-input filtering (not contains())
- Very specific: line 75
Prefer static member lookup (.blue vs Color.blue)
- Very specific: line 76
Use .task modifier for automatic cancellation of async work
- Very specific: line 77
Use .task(id:) for value-dependent tasks
- Distinctive: line 82
Keep views small for optimal performance
- Very specific: line 83
Keep view body simple and pure (no side effects or complex logic)
- Very specific: line 84
Use @ViewBuilder functions only for small, simple sections
- Very specific: line 85
Prefer @ViewBuilder let content: Content over closure-based content properties
- Distinctive: line 88
Use relative layout over hard-coded constants
- Distinctive: line 94
Check for value changes before assigning state in hot paths
- Very specific: line 95
Avoid redundant state updates in onReceive, onChange, scroll handlers
- Very specific: line 97
Use LazyVStack/LazyHStack for large lists
- Very specific: line 98
Use stable identity for ForEach (never .indices for dynamic content)
- Very specific: line 99
Ensure constant number of views per ForEach element
- Very specific: line 100
Avoid inline filtering in ForEach (prefilter and cache)
- Very specific: line 101
Avoid AnyView in list rows
- Distinctive: line 102
Consider POD views for fast diffing (or wrap expensive views in POD parents)
- Very specific: line 104
Avoid layout thrash (deep hierarchies, excessive GeometryReader)
- Very specific: line 106
Use Self._printChanges() to debug unexpected view updates
- Very specific: line 109
Use .animation(_:value:) with value parameter (deprecated version without value is too broad)
- Very specific: line 110
Use withAnimation for event-driven animations (button taps, gestures)
- Very specific: line 111
Prefer transforms (offset, scale, rotation) over layout changes (frame) for performance
- Very specific: line 114
Use .phaseAnimator for multi-step sequences (iOS 17+)
- Very specific: line 115
Use .keyframeAnimator for precise timing control (iOS 17+)
- Very specific: line 121
Use native glassEffect, GlassEffectContainer, and glass button styles
- Very specific: line 124
Use .interactive() only for tappable/focusable elements
- Very specific: line 125
Use glassEffectID with @Namespace for morphing transitions
“Common” is measured: kept by at least 6 in 10 of the 24 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
SwiftUI Expert Skill
Overview
Use this skill to build, review, or improve SwiftUI features with correct state management, modern API usage, Swift concurrency best practices, 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
- Check property wrapper usage against the selection guide (see
references/state-management.md) - Verify modern API usage (see
references/modern-apis.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) - 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
- Audit state management for correct wrapper selection (prefer
@ObservableoverObservableObject) - Replace deprecated APIs with modern equivalents (see
references/modern-apis.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) - Suggest image downsampling when
UIImage(data:)is used (as optional optimization, seereferences/image-optimization.md) - Adopt Liquid Glass only when explicitly requested by the user
3) Implement new SwiftUI feature
- Design data flow first: identify owned vs injected state (see
references/state-management.md) - Use modern APIs (no deprecated modifiers or patterns, see
references/modern-apis.md) - Use
@Observablefor shared state (with@MainActorif not using default actor isolation) - Structure views for optimal diffing (extract subviews early, keep views small, see
references/view-structure.md) - Separate business logic into testable models (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) - Apply glass effects after layout/appearance modifiers (see
references/liquid-glass.md) - Gate iOS 26+ features with
#availableand provide fallbacks
Core Guidelines
State Management
- Always prefer
@ObservableoverObservableObjectfor new code - Mark
@Observableclasses with@MainActorunless using default actor isolation - Always mark
@Stateand@StateObjectasprivate(makes dependencies clear) - Never declare passed values as
@Stateor@StateObject(they only accept initial values) - Use
@Statewith@Observableclasses (not@StateObject) @Bindingonly when child needs to modify parent state@Bindablefor injected@Observableobjects needing bindings- Use
letfor read-only values;var+.onChange()for reactive reads - Legacy:
@StateObjectfor ownedObservableObject;@ObservedObjectfor injected - Nested
ObservableObjectdoesn't work (pass nested objects directly);@Observablehandles nesting fine
Modern APIs
- Use
foregroundStyle()instead offoregroundColor() - Use
clipShape(.rect(cornerRadius:))instead ofcornerRadius() - Use
TabAPI instead oftabItem() - Use
Buttoninstead ofonTapGesture()(unless need location/count) - Use
NavigationStackinstead ofNavigationView - Use
navigationDestination(for:)for type-safe navigation - Use two-parameter or no-parameter
onChange()variant - Use
ImageRendererfor rendering SwiftUI views - Use
.sheet(item:)instead of.sheet(isPresented:)for model-based content - Sheets should own their actions and call
dismiss()internally - Use
ScrollViewReaderfor programmatic scrolling with stable IDs - Avoid
UIScreen.main.boundsfor sizing - Avoid
GeometryReaderwhen alternatives exist (e.g.,containerRelativeFrame())
Swift Best Practices
- Use modern Text formatting (
.formatparameters, notString(format:)) - Use
localizedStandardContains()for user-input filtering (notcontains()) - Prefer static member lookup (
.bluevsColor.blue) - Use
.taskmodifier for automatic cancellation of async work - Use
.task(id:)for value-dependent tasks
View Composition
- Prefer modifiers over conditional views for state changes (maintains view identity)
- Extract complex views into separate subviews for better readability and performance
- Keep views small for optimal performance
- Keep view
bodysimple and pure (no side effects or complex logic) - Use
@ViewBuilderfunctions only for small, simple sections - Prefer
@ViewBuilder let content: Contentover closure-based content properties - Separate business logic into testable models (not about enforcing architectures)
- Action handlers should reference methods, not contain inline logic
- Use relative layout over hard-coded constants
- Views should work in any context (don't assume screen size or presentation style)
Performance
- Pass only needed values to views (avoid large "config" or "context" objects)
- Eliminate unnecessary dependencies to reduce update fan-out
- Check for value changes before assigning state in hot paths
- Avoid redundant state updates in
onReceive,onChange, scroll handlers - Minimize work in frequently executed code paths
- Use
LazyVStack/LazyHStackfor large lists - Use stable identity for
ForEach(never.indicesfor dynamic content) - Ensure constant number of views per
ForEachelement - Avoid inline filtering in
ForEach(prefilter and cache) - Avoid
AnyViewin list rows - Consider POD views for fast diffing (or wrap expensive views in POD parents)
- Suggest image downsampling when
UIImage(data:)is encountered (as optional optimization) - Avoid layout thrash (deep hierarchies, excessive
GeometryReader) - Gate frequent geometry updates by thresholds
- Use
Self._printChanges()to debug unexpected view updates
Animations
- Use
.animation(_:value:)with value parameter (deprecated version without value is too broad) - Use
withAnimationfor event-driven animations (button taps, gestures) - Prefer transforms (
offset,scale,rotation) over layout changes (frame) for performance - Transitions require animations outside the conditional structure
- Custom
Animatableimplementations must have explicitanimatableData - Use
.phaseAnimatorfor multi-step sequences (iOS 17+) - Use
.keyframeAnimatorfor precise timing control (iOS 17+) - Animation completion handlers need
.transaction(value:)for reexecution - Implicit animations override explicit animations (later in view tree wins)
Liquid Glass (iOS 26+)
Only adopt when explicitly requested by the user.
- Use native
glassEffect,GlassEffectContainer, and glass button styles - Wrap multiple glass elements in
GlassEffectContainer - Apply
.glassEffect()after layout and visual modifiers - Use
.interactive()only for tappable/focusable elements - Use
glassEffectIDwith@Namespacefor morphing transitions
Quick Reference
Property Wrapper Selection (Modern)
| Wrapper | Use When |
@State | Internal view state (must be private), or owned @Observable class |
@Binding | Child modifies parent's state |
@Bindable | Injected @Observable needing bindings |
let | Read-only value from parent |
var | Read-only value watched via .onChange() |
Legacy (Pre-iOS 17):
| Wrapper | Use When |
@StateObject | View owns an ObservableObject (use @State with @Observable instead) |
@ObservedObject | View receives an ObservableObject |
Modern API Replacements
| Deprecated | Modern Alternative |
foregroundColor() | foregroundStyle() |
cornerRadius() | clipShape(.rect(cornerRadius:)) |
tabItem() | Tab API |
onTapGesture() | Button (unless need location/count) |
NavigationView | NavigationStack |
onChange(of:) { value in } | onChange(of:) { old, new in } or onChange(of:) { } |
fontWeight(.bold) | bold() |
GeometryReader | containerRelativeFrame() or visualEffect() |
showsIndicators: false | .scrollIndicators(.hidden) |
String(format: "%.2f", value) | Text(value, format: .number.precision(.fractionLength(2))) |
string.contains(search) | string.localizedStandardContains(search) (for user input) |
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
State Management
- Using
@Observableinstead ofObservableObjectfor new code @Observableclasses marked with@MainActor(if needed)- Using
@Statewith@Observableclasses (not@StateObject) @Stateand@StateObjectproperties areprivate- Passed values NOT declared as
@Stateor@StateObject @Bindingonly where child modifies parent state@Bindablefor injected@Observableneeding bindings- Nested
ObservableObjectavoided (or passed directly to child views)
Modern APIs (see references/modern-apis.md)
- Using
foregroundStyle()instead offoregroundColor() - Using
clipShape(.rect(cornerRadius:))instead ofcornerRadius() - Using
TabAPI instead oftabItem() - Using
Buttoninstead ofonTapGesture()(unless need location/count) - Using
NavigationStackinstead ofNavigationView - Avoiding
UIScreen.main.bounds - Using alternatives to
GeometryReaderwhen possible - Button images include text labels for accessibility
Sheets & Navigation (see references/sheet-navigation-patterns.md)
- Using
.sheet(item:)for model-based sheets - Sheets own their actions and dismiss internally
- Using
navigationDestination(for:)for type-safe navigation
ScrollView (see references/scroll-patterns.md)
- Using
ScrollViewReaderwith stable IDs for programmatic scrolling - Using
.scrollIndicators(.hidden)instead of initializer parameter
Text & Formatting (see references/text-formatting.md)
- Using modern Text formatting (not
String(format:)) - Using
localizedStandardContains()for search filtering
View Structure (see references/view-structure.md)
- Using modifiers instead of conditionals for state changes
- Complex views extracted to separate subviews
- Views kept small for performance
- Container views use
@ViewBuilder let content: Content
Performance (see references/performance-patterns.md)
- View
bodykept simple and pure (no side effects) - Passing only needed values (not large config objects)
- Eliminating unnecessary dependencies
- State updates check for value changes before assigning
- Hot paths minimize state updates
- No object creation in
body - Heavy computation moved out of
body
List Patterns (see references/list-patterns.md)
- ForEach uses stable identity (not
.indices) - Constant number of views per ForEach element
- No inline filtering in ForEach
- No
AnyViewin list rows
Layout (see references/layout-best-practices.md)
- Avoiding layout thrash (deep hierarchies, excessive GeometryReader)
- Gating frequent geometry updates by thresholds
- Business logic separated into testable models
- Action handlers reference methods (not inline logic)
- Using relative layout (not hard-coded constants)
- Views work in any context (context-agnostic)
Animations (see references/animation-basics.md, references/animation-transitions.md, references/animation-advanced.md)
- Using
.animation(_:value:)with value parameter - Using
withAnimationfor event-driven animations - Transitions paired with animations outside conditional structure
- Custom
Animatablehas explicitanimatableDataimplementation - 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
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/state-management.md- Property wrappers and data flow (prefer@Observable)references/view-structure.md- View composition, extraction, and container patternsreferences/performance-patterns.md- Performance optimization techniques and anti-patternsreferences/list-patterns.md- ForEach identity, stability, and list best practicesreferences/layout-best-practices.md- Layout patterns, context-agnostic views, and testabilityreferences/modern-apis.md- Modern API usage and deprecated replacementsreferences/animation-basics.md- Core animation concepts, implicit/explicit animations, timing, performancereferences/animation-transitions.md- Transitions, custom transitions, Animatable protocolreferences/animation-advanced.md- Transactions, phase/keyframe animations (iOS 17+), completion handlers (iOS 17+)references/sheet-navigation-patterns.md- Sheet presentation and navigation patternsreferences/scroll-patterns.md- ScrollView patterns and programmatic scrollingreferences/text-formatting.md- Modern text formatting and string operationsreferences/image-optimization.md- AsyncImage, image downsampling, and optimizationreferences/liquid-glass.md- iOS 26+ Liquid Glass API
Philosophy
This skill focuses on facts and best practices, not architectural opinions:
- We don't enforce specific architectures (e.g., MVVM, VIPER)
- We do encourage separating business logic for testability
- We prioritize modern APIs over deprecated ones
- We emphasize thread safety with
@MainActorand@Observable - We optimize for performance and maintainability
- We follow Apple's Human Interface Guidelines and API design patterns
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

