This skill encodes design principles derived from comparing polished, production-quality SwiftUI apps against poorly-built ones. The patterns here represent what separates an app that feels "right" from one where the margins, spacing, and text sizes just look "off."
Apply these principles whenever building or modifying SwiftUI interfaces, WidgetKit widgets, or any native Apple UI.
Core Philosophy
Restraint over decoration. Every pixel must earn its place. A polished app uses fewer colors, fewer font sizes, fewer spacing values, and fewer words — but uses them consistently. Over-engineering visual elements (custom gradients, decorative borders, bespoke dividers) creates visual noise. Native components and system colors create harmony.
Attention is scarce. Keep UI copy shorter than you think it needs to be. Prefer one clear headline and one compact supporting block over repeated explanation in the title, subtitle, body, and footer. If a screen needs rationale, put it in one purposeful place instead of scattering it across the page.
1. Spacing System: Use a Consistent Grid
CRITICAL: Use spacing values from a base-4/base-8 grid. Never use arbitrary values.
Allowed spacing values
Bad (arbitrary values that create visual dissonance)
Good (values from a consistent grid)
Standard padding assignments
- Outer content padding: 16-20pt horizontal
- Between major sections: 24-32pt vertical
- Within grouped components: 4-12pt
- Card/row internal padding: 12-16pt vertical, 16pt horizontal
2. Typography: Hierarchy Through Weight, Not Just Size
The principle
Use fewer font sizes with clear weight differentiation. Lighter weights at larger sizes; medium/regular at smaller sizes. This creates sophistication rather than visual chaos.
Recommended type scale (for a data-focused app)
Bad (too many sizes, inconsistent weights)
Good (clear hierarchy, fewer sizes)
Font design consistency
Pick ONE font design and use it everywhere -- app AND widgets:
Letter spacing (tracking)
Use at most 2 values, and only on uppercase labels:
Never use 3+ different tracking values like kerning(4), kerning(4.5), kerning(5) -- the differences are imperceptible but the inconsistency registers subconsciously.
Numeric formatting for identifiers
Years and other fixed identifiers should not be locale-grouped.
3. Colors: System Semantic Colors Over Hardcoded Values
The principle
Use SwiftUI's semantic color system. It automatically handles light/dark mode, accessibility, and looks native. Hardcoded colors with manual opacity values create maintenance nightmares and look artificial.
Bad (hardcoded white with a dozen opacity values)
Good (semantic system colors)
When you do need opacity
Limit to 2-3 values with clear purposes:
4. Component Sizing: Proportional, Not Oversized
Progress rings / circular indicators
Stroke width consistency
Always use the same lineWidth for background and foreground strokes of the same element:
List rows and toggle rows
5. Grouped Content & Cards: Use System Patterns
Bad (over-engineered custom card)
Good (native grouped style)
Key rules for grouped content
- Corner radius: 10pt for cards/groups (matches iOS system style). Never 22pt+.
- Dividers: Use the system
Divider()with.padding(.leading, 16)for iOS-standard inset. Never build custom divider structs. - Card padding: 12-16pt vertical, 16pt horizontal. Never 4pt vertical.
- Background:
Color(.secondarySystemBackground)-- never custom gradients for standard cards.
6. Navigation: Use NavigationStack
7. WidgetKit: Use Native Components
Circular lock screen widget
Rectangular lock screen widget
Widget background
Widget family coverage
Support all relevant families -- don't skip common ones:
Cross-family visual consistency
Medium and large home widgets should share the same structural layout:
- Header: year on the left, percentage on the right
- Middle: progress bar
- Footer:
day/totalright aligned
Do not re-invent hierarchy per family unless there is a hard size constraint.
Always include explicit internal padding on home widgets to avoid clipping near rounded edges:
Widget memory budget (hard limit)
Widget extensions have a tight memory budget (commonly around 30 MB). Dense visualizations can be killed by EXC_RESOURCE if built from too many nested views.
Timeline refresh (match data granularity)
8. Interactive Elements
Toggles
Mutually exclusive options
When options are exclusive (e.g. daily/weekly/monthly cadence), use one selected value, not three independent toggles.
Animated transitions for changing numbers
9. Interactive Editors: Centralize Geometry and State
Interactive editors (collages, crops, canvases, media framing tools, layout pickers) need stricter state and layout discipline than ordinary forms.
Presentation state
Present editor flows from payload state, not from a separate Bool plus independently-managed data.
Shared geometry model
If the app previews pan/zoom/crop/layout live and later exports the result, use one shared geometry model for both preview and render.
If a user can zoom out enough to reveal background, that must be an intentional part of the shared geometry model, not an editor-only exception.
Gesture coordination
Tap, long-press-drag, and pinch are not independent features. In SwiftUI they compete unless you model their relationship explicitly.
- Use a single interaction state for the active tile/card/canvas item.
- Decide which gesture has priority and which ones should run simultaneously.
- Reset temporary gesture state deliberately when selection changes.
- Prefer one coherent state machine over scattered booleans tied to individual gestures.
Fixed editor layout
If the screen must not scroll, budget vertical space top-down using a few named regions:
- header
- canvas stage
- settings region
- bottom toolbar
Keep that sizing math in one place. Don't let each subview invent its own height.
Custom headers and safe areas
If you replace the system navigation bar with a custom header:
- Be explicit about whether the parent already respects the safe area.
- Do not add
safeAreaInsets.topreflexively; double-counting it creates obvious dead space. - Keep custom headers compact. They should feel like navigation chrome, not a full content section.
Settings surfaces
When an editor has several configuration modes (Layout, Border, Ratio, Background, etc.), show one active settings surface at a time instead of stacking every control on screen.
This keeps the canvas visually dominant and makes each control group easier to understand.
10. Data Model: Share Between App and Widgets
11. Quick Checklist
Before shipping any SwiftUI view, verify:
- All spacing values come from the grid (4, 8, 12, 16, 20, 24, 32)
- Font sizes limited to 5 or fewer distinct values
- One font design used consistently (including widgets)
- Colors use semantic system colors, not hardcoded values with opacity
- Background and foreground strokes use the same lineWidth
- Cards use
Color(.secondarySystemBackground)with 10pt corner radius - Dividers use system
Divider()with leading padding - Toggle rows use Toggle's built-in label (not
.labelsHidden()) - Lock screen widgets use
Gauge(not manual circle drawing) - Widget background uses
.containerBackground(.fill.tertiary, for: .widget) - Year/identifier text avoids locale grouping when grouping is not desired
- Tracking/kerning limited to 2 values max
- NavigationStack is used (not bare ZStack)
- Timeline refresh rate matches data granularity (midnight vs periodic)
- Large/dense widget visuals use
Canvasor similarly lightweight rendering - Medium and large widget families share consistent hierarchy and internal padding
- Exclusive choices use a single selected value (not multiple toggles)
- Percentages include time-of-day when UI implies live progress
- No
minimumScaleFactorhacks -- fix the layout instead - Interactive editors present from payload state, not
Bool+ separate data - Preview and export share the same geometry model for pan/zoom/crop/layout
- Custom headers do not double-count top safe-area inset
- No-scroll editor screens budget height through a centralized layout model
- Multi-mode editors show one focused settings surface instead of every control at once

