git clone https://github.com/ComeOnOliver/skillshub
T=$(mktemp -d) && git clone --depth=1 https://github.com/ComeOnOliver/skillshub "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/pproenca/dot-skills/ios-animations" ~/.claude/skills/comeonoliver-skillshub-ios-animations && rm -rf "$T"
skills/pproenca/dot-skills/ios-animations/SKILL.mddot-skills — Airbnb iOS SwiftUI Animations Best Practices
Opinionated, strict animation craft guide for SwiftUI iOS 26 / Swift 6.2 apps. Contains 50 rules across 8 categories, prioritized by impact. Derived from Airbnb Engineering motion patterns, Apple WWDC sessions, and Apple Human Interface Guidelines. Mandates @Equatable on every animated view, motion tokens for all spring/timing values, and design system tokens for layout.
Mandated Architecture Alignment
This skill is designed to work alongside
swift-ui-architect and ios-design-system. All code examples follow the same non-negotiable constraints:
macro on every view (Airbnb measured 15% scroll hitch reduction)@Equatable
for complex animation state that involves business logic triggers@Observable
for view-owned animation state (toggle booleans, drag offsets)@State- Design system tokens:
,Spacing.xs/sm/md/lg
— zero hardcoded layout numbersRadius.sm/md/lg - Motion tokens:
— zero scattered spring literalsMotion.standard/responsive/playful - Semantic colors:
,.backgroundSurface
— no raw Color literals in views.accentPrimary - Feature animations remain presentation-only; data/network concerns stay in Data package
Scope & Relationship to Sibling Skills
This skill is the motion layer — it teaches how to BUILD fluid, performant animations. When loaded alongside sibling skills:
| Sibling Skill | Its Focus | This Skill's Focus |
|---|---|---|
| Architecture (modular MVVM-C, route shells, protocol boundaries) | Animation architecture (motion tokens, spring selection, orchestration) |
| Design system infrastructure (tokens, styles, governance) | Motion tokens and animated component patterns |
| HIG compliance patterns | Motion-specific HIG (reduce motion, spatial continuity) |
Out of scope: Designer-authored vector animations (use Lottie for After Effects exports). Complex UIKit transition controllers (see Airbnb's declarative transition framework). This skill covers programmatic SwiftUI animations only.
Clinic Architecture Contract (iOS 26 / Swift 6.2)
All guidance in this skill assumes the clinic modular MVVM-C architecture:
- Feature modules import
+Domain
only (neverDesignSystem
, never sibling features)Data - App target is the convergence point and owns
, concrete coordinators, and Route Shell wiringDependencyContainer
stays pure Swift and defines models plus repository,Domain
,*Coordinating
, andErrorRouting
contractsAppError
owns SwiftData/network/sync/retry/background I/O and implements Domain protocolsData- Read/write flow defaults to stale-while-revalidate reads and optimistic queued writes
- ViewModels call repository protocols directly (no default use-case/interactor layer)
When to Apply
Reference these guidelines when:
- Adding animations to SwiftUI views or transitions
- Building gesture-driven interactions (drag, swipe, pan)
- Connecting views with spatial transitions (expand/collapse, navigation morphs)
- Designing micro-interactions (button press, toggle, loading states)
- Making content changes feel physical (number rolls, symbol replacements)
- Choreographing multi-element animation sequences (KeyframeAnimator, PhaseAnimator)
- Defining motion tokens for a design system
- Reviewing animation code for performance, accessibility, and architecture compliance
Rule Categories by Priority
| Priority | Category | Impact | Prefix | Rules |
|---|---|---|---|---|
| 1 | Spring Physics | CRITICAL | | 8 |
| 2 | Timing & Feel | CRITICAL | | 6 |
| 3 | Gesture Continuity | HIGH | | 7 |
| 4 | Spatial Transitions | HIGH | | 6 |
| 5 | Micro-interactions | HIGH | | 6 |
| 6 | Orchestration | HIGH | | 5 |
| 7 | Craft & Polish | HIGH | | 5 |
| 8 | Content Motion | MEDIUM-HIGH | | 5 |
Quick Reference
1. Spring Physics (CRITICAL)
— Define motion tokens as a caseless enum for all spring presetsspring-motion-tokens
— Default to .smooth spring for all UI transitionsspring-smooth-default
— Use .snappy spring for responsive interactionsspring-snappy-responsive
— Use .bouncy spring for playful and celebratory momentsspring-bouncy-celebration
— Tune custom springs with response and dampingFractionspring-custom-parameters
— Springs preserve velocity on interruptionspring-velocity-preservation
— Never use linear or easeInOut for interactive UIspring-never-linear
— Use withAnimation completion for chained sequencesspring-completion-chaining
2. Timing & Feel (CRITICAL)
— Keep UI animations under 250msfeel-250ms-max
— Faster animations almost always feel betterfeel-faster-better
— Use asymmetric timing for enter and exitfeel-asymmetric-enter-exit
— Match duration to distance traveledfeel-distance-proportional
— Sync haptic feedback to visual animation keyframesfeel-haptic-sync
— Stagger reveals at 30-50ms intervalsfeel-stagger-timing
3. Gesture Continuity (HIGH)
— Rubber band at drag boundariesgesture-rubber-band
— Dismiss on velocity OR distance thresholdgesture-momentum-dismiss
— Use velocity-aware snap pointsgesture-snap-points
— Make all gesture animations interruptiblegesture-interruptible
— Resolve scroll and drag gesture conflictsgesture-scroll-drag-conflict
— Use GestureState for transient drag stategesture-state-transient
— Project gesture velocity for natural landing positiongesture-projected-landing
4. Spatial Transitions (HIGH)
— Use matchedGeometryEffect for expand/collapse morphsspatial-matched-geometry
— Use zoom navigation transition for collection detail (iOS 18)spatial-zoom-navigation
— Anchor transitions to their trigger locationspatial-transition-origin
— Share multiple element IDs for rich hero animationsspatial-hero-shared-element
— Use matchedGeometryEffect for sheet presentationsspatial-sheet-morph
— Maintain spatial direction in tab transitionsspatial-tab-continuity
5. Micro-interactions (HIGH)
— Scale buttons to 0.97 on press for tactile feedbackmicro-button-press-scale
— Pair every visual state change with haptic feedbackmicro-haptic-pairing
— Use symbolEffect for SF Symbol animationsmicro-symbol-effect
— Add bounce to toggle state changesmicro-toggle-bounce
— Animate progressive fill for long press actionsmicro-long-press-fill
— Use repeating spring for organic loading statesmicro-loading-phase
6. Orchestration (HIGH)
— Use PhaseAnimator for multi-step sequencesorch-phase-animator
— Use KeyframeAnimator for timeline-precise motionorch-keyframe-animator
— Stagger child elements for orchestrated revealsorch-stagger-children
— Coordinate multi-element entrances with shared triggerorch-coordinated-entrance
— Use TimelineView for continuous repeating animationsorch-timeline-view
7. Craft & Polish (HIGH)
— Respect accessibilityReduceMotion with crossfade fallbackcraft-reduce-motion
— Use blur to bridge imperfect transition statescraft-blur-bridge
— Use drawingGroup() for Metal-backed complex animationscraft-drawing-group
— Use geometryGroup() to isolate layout animation propagationcraft-geometry-group
— Use Transaction to debug and override animation behaviorcraft-transaction-debug
8. Content Motion (MEDIUM-HIGH)
— Use contentTransition(.numericText) for number changescontent-numeric-text
— Use scrollTransition for scroll-position effectscontent-scroll-transition
— Use visualEffect for position-aware animationscontent-visual-effect
— Animate symbol replacement with contentTransitioncontent-symbol-replace
— Use Text Renderer for character-level animation (iOS 18)content-text-renderer
How to Use
Read individual reference files for detailed explanations with incorrect/correct 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 |