ios-ui-refactor
npx skills add https://github.com/pproenca/dot-skills --skill ios-ui-refactor
Agent 安装分布
Skill 文档
Apple HIG SwiftUI iOS 17+ Best Practices
A principal designer’s lens for evaluating and refactoring SwiftUI interfaces to Apple-quality standards. Contains 48 rules across 8 categories, ordered by the visual review process a senior Apple designer follows when auditing an app. Each rule identifies a specific anti-pattern, explains why it degrades the experience, and provides the iOS 17+ fix while respecting the app’s brand voice.
Scope & Relationship to Sibling Skills
This skill is the refactoring and review lens â it evaluates existing UI and identifies visual anti-patterns to fix. When loaded alongside ios-design (building new UI), ios-hig (HIG compliance), or swift-refactor (code-level refactoring), this skill supersedes overlapping rules with more detailed “incorrect â correct” transformations and “When NOT to apply” guidance. Use this skill for auditing and improving existing screens; use the siblings for greenfield implementation.
When to Apply
Reference these guidelines when:
- Reviewing existing SwiftUI screens for visual quality issues
- Auditing typography scale, weight usage, and type treatments
- Evaluating color system coherence across light and dark mode
- Refactoring animations from legacy easeInOut to spring-based motion
- Fixing navigation transitions that break spatial continuity
- Replacing custom overlays with Apple’s materials system
- Standardizing spacing, touch targets, and corner radii
- Adopting iOS 17-18 APIs like scrollTransition, PhaseAnimator, or MeshGradient
Rule Categories by Priority
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Visual Hierarchy | CRITICAL | hier- |
| 2 | Typography Discipline | CRITICAL | typo- |
| 3 | Color System | CRITICAL | color- |
| 4 | Motion & Animation | HIGH | motion- |
| 5 | Screen Transitions | HIGH | trans- |
| 6 | Materials & Depth | HIGH | depth- |
| 7 | Spacing & Rhythm | MEDIUM-HIGH | rhythm- |
| 8 | iOS 17+ Modernization | MEDIUM | modern- |
Quick Reference
1. Visual Hierarchy (CRITICAL)
hier-single-focal– One primary focal point per screenhier-size-weight-contrast– Combine size, weight, and contrast for hierarchyhier-progressive-disclosure– Use progressive disclosure for dense informationhier-card-modularity– Use self-contained cards for dashboard layoutshier-whitespace-grouping– Use whitespace to separate conceptual groupshier-reading-order– Align visual weight with logical reading order
2. Typography Discipline (CRITICAL)
typo-system-text-styles– Use Apple text styles, never fixed font sizestypo-weight-not-caps– Use weight for emphasis, not ALL CAPStypo-single-typeface– One typeface per app, differentiate with weight and sizetypo-max-styles-per-screen– Limit to 3-4 distinct type treatments per screentypo-no-light-body– Avoid light font weights for body texttypo-foreground-style– Use foregroundStyle over foregroundColor
3. Color System (CRITICAL)
color-semantic-always– Use semantic colors, never hard-coded black or whitecolor-role-naming– Name custom colors by role, not huecolor-contrast-aa– Ensure WCAG AA contrast ratioscolor-saturated-small– Reserve saturated colors for small interactive elementscolor-dark-mode-pairs– Define light and dark variants for every custom colorcolor-brand-within-system– Map brand palette onto iOS semantic color rolescolor-one-purpose– Each semantic color serves exactly one purpose
4. Motion & Animation (HIGH)
motion-spring-default– Default to spring animations for all UI transitionsmotion-spring-presets– Use .smooth for routine, .snappy for interactive, .bouncy for delightmotion-no-linear-easeInOut– Prefer springs over linear and easeInOut for UI elementsmotion-symbol-effects– Use built-in symbolEffect, not manual symbol animationmotion-content-transition– Use contentTransition for changing text and numbersmotion-reduce-motion– Always provide reduce motion fallbackmotion-purposeful– Every animation must communicate state change or provide feedback
5. Screen Transitions (HIGH)
trans-zoom-collections– Use zoom transitions for collection-to-detail navigationtrans-sheet-vs-push– Sheets for tasks and creation, push for drill-down hierarchytrans-multi-detent-sheets– Provide multiple sheet detents with drag indicatortrans-matched-geometry– Use matchedGeometryEffect for contextual origin transitionstrans-no-hard-cuts– Always animate between states, even minimallytrans-preserve-swipe-back– Never break the system back-swipe gesture
6. Materials & Depth (HIGH)
depth-materials-not-opacity– Use system materials, not custom semi-transparent backgroundsdepth-vibrancy-hierarchy– Match vibrancy level to content importancedepth-material-thickness– Choose material thickness by contrast needsdepth-background-interaction– Enable background interaction for peek-style sheetsdepth-shadow-vs-material– Use materials for layering, not drop shadows for depth
7. Spacing & Rhythm (MEDIUM-HIGH)
rhythm-consistent-grid– Use a 4pt base unit for all spacingrhythm-touch-targets– All interactive elements at least 44×44 pointsrhythm-consistent-radii– Standardize corner radii per component typerhythm-consistent-padding– Use consistent padding across all screensrhythm-alignment-consistency– Consistent alignment per content type within a screenrhythm-safe-area-respect– Always respect safe areas
8. iOS 17+ Modernization (MEDIUM)
modern-scroll-transitions– Use scrollTransition for scroll-position visual effectsmodern-phase-animator– Use PhaseAnimator for multi-step animation sequencesmodern-mesh-gradients– Use MeshGradient for premium dynamic backgroundsmodern-text-renderer– Use TextRenderer for hero text animations onlymodern-inspector– Use inspector for trailing-edge detail panels
How to Use
Read individual reference files for detailed explanations and code examples:
- Section definitions – Category structure and impact levels
- Rule template – Template for adding new rules
Reference Files
| File | Description |
|---|---|
| references/_sections.md | Category definitions and ordering |
| assets/templates/_template.md | Template for new rules |
| metadata.json | Version and reference information |