swiftui-pro-patterns/SKILL.md
Advanced SwiftUI patterns from Pro SwiftUI (Hudson, 2022). Deep layout mechanics, identity, animation, custom layouts, environment/preferences, drawing, and performance.
npx skillsauth add peterbamuhigire/skills-web-dev swiftui-pro-patternsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
swiftui-pro-patterns or would be better handled by a more specific companion skill.SKILL.md first, then load only the referenced deep-dive files that are necessary for the task.Advanced patterns for experienced SwiftUI developers. Covers the internals that make SwiftUI tick.
| Value | Purpose | |-------|---------| | minWidth / minHeight | Least space accepted; below this the view "leaks" out | | maxWidth / maxHeight | Most space accepted; excess is ignored | | idealWidth / idealHeight | Preferred size (like UIKit intrinsicContentSize) |
Key insight: fixedSize() promotes ideal size to be both min and max size.
// fixedSize on one axis -- text wraps horizontally but grows vertically
Text("Long text here")
.fixedSize(horizontal: false, vertical: true)
// Make two HStack children the same height
HStack {
Text("Short").padding().frame(maxHeight: .infinity).background(.yellow)
Text("Much longer text").padding().frame(maxHeight: .infinity).background(.cyan)
}
.fixedSize(horizontal: false, vertical: true)
Views that adapt to whatever space is available. Color.red fills all space; as a background it shrinks to its child.
// Color in ScrollView gets nominal 10pt height (replacingUnspecifiedDimensions default)
ScrollView { Color.red } // Only 10pt tall
// Fix: provide explicit ideal height
ScrollView {
Color.red.frame(idealHeight: 400, maxHeight: 400)
}
Every modifier (mostly) creates a new ModifiedContent wrapper view. Modifiers do NOT mutate the original view.
// Two frames = two separate wrapper views (fixed + flexible)
Text("Hello")
.frame(width: 250) // Fixed width wrapper
.frame(minHeight: 400) // Flexible height wrapper
Anti-pattern: Thinking frame() changes the text itself. It wraps it.
Extended guidance for swiftui-pro-patterns was moved to references/skill-deep-dive.md to keep this entrypoint compact and fast to load.
Use that deep dive for:
2. View Identity (Critical for Performance)3. Animation Patterns4. Environment and Preferences5. Custom Layouts (Layout Protocol)6. Drawing and Effects7. Performance PatternsAnti-Patterns Summarydata-ai
Use when adding AI-powered analytics to a SaaS platform — semantic search over business data, natural language queries, trend detection, anomaly alerts, and AI-generated insights for dashboards. Covers embeddings, NL2SQL, and per-tenant analytics...
data-ai
Design AI-powered analytics dashboards — what metrics to show, how to display AI predictions and confidence, drill-down patterns, KPI cards, trend visualisation, AI Insights panels, export design, and role-based dashboard variants. Invoke when...
development
Use when designing, building, reviewing, or upgrading production software systems that must be secure, performant, maintainable, scalable, and user-centered. Apply before writing specs, code, architecture, APIs, databases, mobile apps, SaaS platforms, or ERP systems.
development
Professional web app UI using commercial templates (Tabler/Bootstrap 5) with strong frontend design direction when needed. Use for CRUD interfaces, dashboards, admin panels with SweetAlert2, DataTables, Flatpickr. Clone seeder-page.php, use...