swiftui-ui-patterns
Best practices and example-driven guidance for building SwiftUI views and components. Use when creating or refactoring SwiftUI UI, designing tab architecture with TabView, composing screens, or needing component-specific patterns and examples.
Why use this skill?
Learn to build modern, maintainable SwiftUI interfaces with expert patterns for state management, navigation, and composition using the OpenClaw SwiftUI skill.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/dimillian/swiftui-ui-patternsWhat This Skill Does
The swiftui-ui-patterns skill serves as a centralized, expert-level repository of best practices for Apple's SwiftUI framework. It is designed to assist developers in architecting clean, maintainable, and highly performant interfaces by enforcing modern Swift paradigms. By leveraging this skill, OpenClaw agents provide standardized guidance on component composition, state management, and navigation patterns (such as TabView and NavigationStack). It enforces strict adherence to declarative UI principles, ensuring that developers avoid legacy anti-patterns while promoting a modular approach through small, focused subviews. This skill acts as a living style guide that evolves with the project, ensuring consistency across complex enterprise apps or simple scaffolding projects.
Installation
To integrate this skill into your environment, run the following command in your terminal:
clawhub install openclaw/skills/skills/dimillian/swiftui-ui-patterns
Use Cases
- Project Scaffolding: Rapidly set up new SwiftUI applications using optimized
TabViewandNavigationStackwiring. - Refactoring & Optimization: Convert legacy ViewModels or imperative state management into modern
@Observablepatterns. - UI Component Implementation: Access vetted templates for sheets, list/detail views, and editor screens that follow project-specific conventions.
- Navigation Architecture: Architect complex, nested navigation paths using
RouterPathenums and environment-injected dependencies. - Async State Handling: Implement UI that responds to network requests or long-running tasks using
.taskand robust error/loading state enums.
Example Prompts
- "How should I refactor this View to use
.sheet(item:)instead of a boolean binding, and how do I handle the dismiss action inside the child view?" - "Can you help me scaffold a new TabView structure for a productivity app, ensuring that each tab has its own NavigationStack and shared data access?"
- "Review this view code and suggest how to break it down into smaller subviews for better readability and testability following the swiftui-ui-patterns guide."
Tips & Limitations
- State Ownership: Always prioritize local state over global unless absolutely necessary. This keeps views decoupled and simplifies testing.
- Composition over Inheritance: Prefer building small, reusable components. If a view exceeds 100 lines, it is usually a sign to extract subviews.
- Async Patterns: Always implement an explicit loading or error state for async actions to provide better UX.
- Legacy Note: While the skill promotes modern patterns, verify if you are working within a legacy module before applying drastic refactors, as some older UIKit interop might require specific lifecycle handling.
- Component Index: Always check
references/components-index.mdfirst before creating new custom components to prevent duplicate code.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-dimillian-swiftui-ui-patterns": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: file-read
Related Skills
macos-spm-app-packaging
Scaffold, build, and package SwiftPM-based macOS apps without an Xcode project. Use when you need a from-scratch macOS app layout, SwiftPM targets/resources, a custom .app bundle assembly script, or signing/notarization/appcast steps outside Xcode.
app-store-changelog
Create user-facing App Store release notes by collecting and summarizing all user-impacting changes since the last git tag (or a specified ref). Use when asked to generate a comprehensive release changelog, App Store "What's New" text, or release notes based on git history or tags.