swiftui-expert-skill
Skill45 starsChanged 8 months agoMITView on GitHub
Write, review, or improve SwiftUI code using native semantic UI components, strong state management, performance-conscious composition, and deliberate 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 swift-concurrency, swiftui-ui-patterns and 6 more.
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.
jamesrochabrunSkillswift-concurrency
Guide for building, auditing, and refactoring Swift code using modern concurrency patterns (Swift 6+). This skill should be used when working with async/await, Tasks, actors, MainActor, Sendable types, isolation domains, or when migrating legacy callback/Combine code to structured concurrency. Covers Approachable Concurrency settings, isolated parameters, and common pitfalls.
Also in 8 projects that use this
OpenAISkillswiftui-ui-patterns
Build and refactor SwiftUI UI with component patterns and examples. Use when shaping navigation, state, layouts, controls, or screen composition.
Also in 5 projects that use this
AvdLeeSkillswift-testing-expert
Expert guidance for Swift Testing: test structure, #expect/#require macros, traits and tags, parameterized tests, test plans, parallel execution, async waiting patterns, and XCTest migration. Use when writing new Swift tests, modernizing XCTest suites, debugging flaky tests, or improving test quality and maintainability in Apple-platform or Swift server projects.
Also in 3 projects that use this
OpenAISkillswiftui-performance-audit
Audit SwiftUI runtime performance from code first. Use when diagnosing slow rendering, janky scrolling, expensive updates, or profiling needs.
Also in 4 projects that use this
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
eugenepyvovarovSkillswift-concurrency-expert
Swift Concurrency review and remediation for Swift 6.2+. Use when asked to review Swift Concurrency usage, improve concurrency compliance, or fix Swift concurrency compiler errors in a feature or file.
Also in 3 projects that use this
- +2 more from openai
Other versions24 projects use a version of this.
Word for word · 0
None found.
Edited · 14
- Provenance-Emu/Provenance★ 6.4k56% same
- pablopunk/SwiftShift★ 66415% same
- anyproto/anytype-swift★ 52556% same
- AFK-surf/OpenBridge★ 43059% same
- nonameplum/agent-skills★ 1753% same
- xfstudio/skills★ 951% same
- tenondecrpc/tempo-for-claude★ 415% same
- ai4brands-design/claude-skills★ 251% same
- ronrefael/sonde★ 276% same
- shashwattrili/reclaude★ 215% 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 repository7 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- jetpack-compose-material3-expert-skillSkill
- landSkill
- orchestrateSkill
- e2e-videoSkill
- pr-shepherdSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
48 rules. 0 are common, 10 are distinctive, and 38 are very specific to this project.
0
Common
Most of the 24 edited versions we read keep these.
10
Distinctive
This author's own choices. Worth a look.
38
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 16
Verify modern API usage and deprecation replacements (see references/modern-apis.md)
- Very specific: line 17
Verify text formatting and search patterns (see references/text-formatting.md)
- Very specific: line 18
Verify view composition follows extraction rules (see references/view-structure.md)
- Very specific: line 19
Check performance patterns are applied (see references/performance-patterns.md)
- Very specific: line 20
Verify list patterns use stable identity (see references/list-patterns.md)
- Very specific: line 21
Check animation patterns for correctness (see references/animation-basics.md, references/animation-transitions.md)
- Very specific: line 33
Ensure ForEach uses stable identity (see references/list-patterns.md)
- Distinctive: line 37
Do not invent product behavior or ship placeholder/debug copy while redesigning UI
- Very specific: line 45
Keep business logic in services and models for testability (see references/layout-best-practices.md)
- Very specific: line 46
Use correct animation patterns (implicit vs explicit, transitions, see references/animation-basics.md, references/animation-transitions.md, …
- Distinctive: line 47
Use supported app actions and real product states.
- Very specific: line 58
Use let for read-only values.
- Very specific: line 59
Never pass values into @State or @StateObject — they only accept initial values
- Distinctive: line 64
Prefer modifiers over conditional views for state changes (maintains view identity)
- Very specific: line 65
Keep view body simple and pure (no side effects or complex logic)
- Very specific: line 66
Use @ViewBuilder functions only for small, simple sections
- Very specific: line 67
Prefer @ViewBuilder let content: Content over closure-based content properties
- Distinctive: line 68
Keep business logic in services and models.
- Very specific: line 73
Start with Form, Section, List, LabeledContent, NavigationStack, TextField, TextEditor, PasteButton, PhotosPicker, ShareLink, ToolbarItem, …
- Very specific: line 74
Use Form and Section for settings, profile editing, and structured data-entry flows before building custom card stacks
- Very specific: line 75
Use LabeledContent, plain text sections, or list rows for read-only content.
- Distinctive: line 76
Prefer system row, disclosure, and destructive-action patterns over custom button bars when the semantics match
- Very specific: line 77
Use raw VStack and HStack for screen-level structure only when semantic containers cannot express the UI cleanly
- Very specific: line 78
Treat safeAreaInset as layout ownership, not just presentation.
- Very specific: line 80
Do not feed measured safeAreaInset heights back into a UIKit scroll view unless there is no cleaner ownership boundary.
- Distinctive: line 82
If a control must stay pinned above a chat composer, put that control in the same UIKit host/accessory coordinate system as the composer.
- Very specific: line 83
If both the transcript and a pinned control depend on bottom chrome, derive both from the same native guide (keyboardLayoutGuide, accessory …
- Distinctive: line 84
Keep accessibility identifiers unique and preserve existing IDs during refactors unless tests and callers are updated together
- Distinctive: line 85
Do not remove working actions or ship placeholder/debug copy during visual changes
- Distinctive: line 92
Check for value changes before assigning state in hot paths
- Very specific: line 93
Avoid redundant state updates in onReceive, onChange, scroll handlers
- Very specific: line 95
Use LazyVStack/LazyHStack for large lists
- Very specific: line 96
Use stable identity for ForEach (never .indices for dynamic content)
- Very specific: line 97
Ensure constant number of views per ForEach element
- Very specific: line 98
Avoid inline filtering in ForEach (prefilter and cache)
- Very specific: line 99
Avoid AnyView in list rows
- Distinctive: line 100
Consider POD views for fast diffing (or wrap expensive views in POD parents)
- Very specific: line 102
Avoid layout thrash (deep hierarchies, excessive GeometryReader)
- Very specific: line 104
Use Self._printChanges() to debug unexpected view updates
- Very specific: line 107
Use .animation(_:value:) with value parameter (deprecated version without value is too broad)
- Very specific: line 108
Use withAnimation for event-driven animations (button taps, gestures)
- Very specific: line 109
Prefer transforms (offset, scale, rotation) over layout changes (frame) for performance
- Very specific: line 112
Use .phaseAnimator for multi-step sequences (iOS 17+)
- Very specific: line 113
Use .keyframeAnimator for precise timing control (iOS 17+)
- Very specific: line 119
Use native glassEffect, GlassEffectContainer, and glass button styles
- Very specific: line 123
Use .interactive() only for tappable/focusable elements
- Very specific: line 124
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, native semantic UI structure, optimal view composition, and iOS 26+ Liquid Glass styling. Prioritize system containers and controls first, then layer visual polish and Liquid Glass on top of a correct hierarchy. 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) - Inspect semantic container choice and native control usage (see
references/native-semantic-ui.md) - Verify modern API usage and deprecation replacements (see
references/modern-apis.md) - Verify text formatting and search patterns (see
references/text-formatting.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
- For UI-focused changes, verify the result in simulator or previews against real app states before calling the screen complete
2) Improve existing SwiftUI code
- Audit state management for correct wrapper selection (see
references/state-management.md) - Replace stack-heavy custom screen structure with semantic containers where appropriate (see
references/native-semantic-ui.md) - Replace deprecated APIs with modern equivalents (see
references/modern-apis.md) - Replace legacy string/text formatting patterns (see
references/text-formatting.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) - Preserve existing user-facing actions, accessibility IDs, and test hooks during visual refactors
- Do not invent product behavior or ship placeholder/debug copy while redesigning UI
- Validate UI-focused changes one screen at a time in simulator before broad rollout
- Adopt Liquid Glass when requested by the user or when the product's design direction clearly calls for it, after hierarchy and semantics are correct
3) Implement new SwiftUI feature
- Design data flow first: identify owned vs injected state (see
references/state-management.md) - Select semantic containers and system controls before custom layout (see
references/native-semantic-ui.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 supported app actions and real product states; don't invent buttons, copy, or flows that do not exist
- Apply Liquid Glass after hierarchy, accessibility, and interaction states are correct (see
references/liquid-glass.md) - Gate iOS 26+ features with
#availableand provide fallbacks
Core Guidelines
State Management
@Statemust beprivate; use for internal view state@Bindingonly when a child needs to modify parent state@StateObjectwhen view creates the object;@ObservedObjectwhen injected- iOS 17+: Use
@Statewith@Observableclasses; use@Bindablefor injected observables needing bindings - Use
letfor read-only values;var+.onChange()for reactive reads - Never pass values into
@Stateor@StateObject— they only accept initial values - Nested
ObservableObjectdoesn't propagate changes — pass nested objects directly;@Observablehandles nesting fine
View Composition
- Extract complex views into separate subviews for better readability and performance
- Prefer modifiers over conditional views for state changes (maintains view identity)
- 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 - Keep business logic in services and models; views should orchestrate UI flow
- Action handlers should reference methods, not contain inline logic
- Views should work in any context (don't assume screen size or presentation style)
Native Semantics First
- Start with
Form,Section,List,LabeledContent,NavigationStack,TextField,TextEditor,PasteButton,PhotosPicker,ShareLink,ToolbarItem, andContentUnavailableViewwhen they fit the interaction (seereferences/native-semantic-ui.md) - Use
FormandSectionfor settings, profile editing, and structured data-entry flows before building custom card stacks - Use
LabeledContent, plain text sections, or list rows for read-only content; do not mimic editable form fields for display-only data - Prefer system row, disclosure, and destructive-action patterns over custom button bars when the semantics match
- Use raw
VStackandHStackfor screen-level structure only when semantic containers cannot express the UI cleanly - Treat
safeAreaInsetas layout ownership, not just presentation. A custom bottomsafeAreaInsetis not equivalent to nav bars, toolbars, or aninputAccessoryView, especially when UIKit scroll views are involved. - Be cautious using
safeAreaInsetfor chat composers or other keyboard-attached bottom chrome overUIScrollView/UITableView/UICollectionView. It often breaks the illusion of full-bleed underlap while still failing to make the scroll viewport truly "attached" to the custom chrome. - Do not feed measured
safeAreaInsetheights back into a UIKit scroll view unless there is no cleaner ownership boundary. That creates fragile bidirectional layout coupling and often diverges from keyboard/safe-area behavior. - For transcript-style UIs that need Instagram/iMessage behavior, prefer UIKit-owned bottom chrome (
inputAccessoryView, or a child view controller that owns both transcript and composer) over SwiftUIsafeAreaInset. - If a control must stay pinned above a chat composer, put that control in the same UIKit host/accessory coordinate system as the composer. Do not mirror the composer position back into SwiftUI with guessed bottom offsets when the transcript itself is UIKit-owned.
- If both the transcript and a pinned control depend on bottom chrome, derive both from the same native guide (
keyboardLayoutGuide, accessory host constraints, or equivalent). Do not keep separate overlap formulas for the list and the control. - Keep accessibility identifiers unique and preserve existing IDs during refactors unless tests and callers are updated together
- Do not remove working actions or ship placeholder/debug copy during visual changes
- Validate visual refactors in the simulator one screen at a time; treat simulator review as required, not optional
- Apply Liquid Glass after semantics and information hierarchy are correct
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+)
Treat Liquid Glass as a first-class iOS 26+ option when the user's request or the app's design direction calls for it.
- Use native
glassEffect,GlassEffectContainer, and glass button styles - Wrap multiple glass elements in
GlassEffectContainer - Apply glass only after hierarchy, semantics, and interaction states are correct
- Apply
.glassEffect()after layout and visual modifiers - Use
.interactive()only for tappable/focusable elements - Use
glassEffectIDwith@Namespacefor morphing transitions
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() |
Semantic Container Selection
| Use | Prefer |
| Editable settings/profile fields | Form + Section + TextField / TextEditor |
| Read-only label/value rows | LabeledContent or grouped List / Section rows |
| Dynamic collections | List with stable IDs |
| Share/import actions | ShareLink, PasteButton, PhotosPicker |
| Empty states | ContentUnavailableView with fallback when unavailable |
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
@Stateproperties areprivate@Bindingonly where child modifies parent state@StateObjectfor owned,@ObservedObjectfor injected- iOS 17+:
@Statewith@Observable,@Bindablefor injected - Passed values NOT declared as
@Stateor@StateObject - Nested
ObservableObjectavoided (or passed directly to child views)
Sheets & Navigation (see references/sheet-navigation-patterns.md)
- Using
.sheet(item:)for model-based sheets - Sheets own their actions and dismiss internally
Modern APIs (see references/modern-apis.md)
- Deprecated APIs replaced by current SwiftUI alternatives
- Navigation uses
NavigationStack+ type-safe destinations where appropriate - Interaction semantics prefer
ButtonoveronTapGesturewhen possible
Native Semantics & Product Integrity (see references/native-semantic-ui.md)
- Screen-level structure starts from semantic containers before custom stacks
- Edit and display states use different affordances (editable controls vs read-only content)
- Existing user-facing actions are preserved; no fake or placeholder features introduced
- Accessibility identifiers remain unique and intentional
- Icon-only controls have explicit accessibility labels
- UI-focused changes were verified in simulator or previews against real states
ScrollView (see references/scroll-patterns.md)
- Using
ScrollViewReaderwith stable IDs for programmatic scrolling
Text Formatting (see references/text-formatting.md)
- Numeric/date/currency formatting uses modern
Text(..., format:)APIs - User-facing filtering/search uses localized comparisons where appropriate
- Avoiding manual
String(format:)for UI text formatting
View Structure (see references/view-structure.md)
- Using modifiers instead of conditionals for state changes
- Complex views extracted to separate subviews
- 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 kept in services and models (not in views)
- Action handlers reference methods (not inline logic)
- Using relative layout (not hard-coded constants)
- Views work in any context (context-agnostic)
safeAreaInsetis not being used to fake system-owned keyboard/chrome behavior for UIKit scroll views
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 flowreferences/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/native-semantic-ui.md- Native semantic containers, forms, settings, profile patterns, and screen-by-screen validation guidancereferences/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/image-optimization.md- AsyncImage, image downsampling, and optimizationreferences/liquid-glass.md- iOS 26+ Liquid Glass APIreferences/modern-apis.md- Modern SwiftUI API replacements and migration guidance (local extension)references/text-formatting.md- Text/number/date formatting and localized matching patterns (local extension)
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 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.

