- Home
- Skills
- Avdlee
- Swiftui Agent Skill
- Swiftui Expert Skill
swiftui-expert-skill_skill
500
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill avdlee/swiftui-agent-skill --skill swiftui-expert-skill- SKILL.md13.3 KB
Overview
This skill helps write, review, and improve SwiftUI code with modern, performance-conscious practices. It focuses on correct state management, view composition, Swift concurrency, and optional iOS 26+ Liquid Glass styling. Use it to adopt modern APIs, reduce update fan-out, and ensure platform-safe fallbacks.
How this skill works
The skill inspects SwiftUI views for proper property wrapper selection, modern API usage, and efficient view structure. It flags performance anti-patterns, enforces stable list identities, and suggests concurrency and formatting improvements. Liquid Glass advice is provided only when the user requests iOS 26+ styling and includes availability gating and sensible fallbacks.
When to use it
- Building a new SwiftUI feature with modern APIs and concurrency
- Refactoring views to reduce unnecessary state updates and improve diffing
- Reviewing PRs for state, navigation, and list stability issues
- Adopting iOS 26+ Liquid Glass visuals with fallback handling
- Optimizing performance hotspots like lists, onChange handlers, and hot paths
Best practices
- Prefer @Observable over ObservableObject for new shared state and mark with @MainActor when appropriate
- Keep @State and @StateObject private; use @Binding only when a child must modify parent state
- Extract complex UI into small subviews to improve diffing and readability; avoid heavy logic inside body
- Use modern API replacements (foregroundStyle, NavigationStack, Tab API, ImageRenderer) and gate iOS 26+ features with #available
- Pass only needed values to child views, avoid inline filtering in ForEach, and use stable IDs for list elements
- Apply Liquid Glass after layout modifiers and wrap related elements in GlassEffectContainer when requested
Example use cases
- Refactor a feed view to use LazyVStack, stable ForEach IDs, and prefiltered data to prevent list thrash
- Convert an ObservableObject-based view model to @Observable with @MainActor and bind it via @Bindable in child views
- Replace deprecated modifiers (cornerRadius, foregroundColor) with modern equivalents and adjust accessibility labels
- Implement a sheet using .sheet(item:) where the sheet owns its actions and calls dismiss() internally
- Prototype Liquid Glass UI for iOS 26+: use glassEffect with #available and provide material fallback
FAQ
Use @Observable for new shared state; prefer @State for private view state and @Bindable for injected observables. Reserve @StateObject only for legacy code targeting pre-iOS 17 patterns.
How do I adopt Liquid Glass safely?
Only enable Liquid Glass when requested. Gate with #available(iOS 26, *), apply .glassEffect() after layout modifiers, wrap related components in GlassEffectContainer, and provide ultraThinMaterial fallbacks for older OS versions.