Animation Patterns
Correct API shapes and patterns for SwiftUI animations. Prevents the most common mistakes: mixed spring parameter generations, wrong PhaseAnimator/KeyframeAnimator closure signatures, and using matchedGeometryEffect where matchedTransitionSource is needed.
When This Skill Activates
Use this skill when the user:
- Asks to add, fix, or review animation code
- Mentions spring, bounce, or snappy animations
- Wants view transitions (insertion/removal, hero, zoom)
- Asks about PhaseAnimator or KeyframeAnimator
- Wants SF Symbol effects (bounce, pulse, wiggle, breathe)
- Mentions matchedGeometryEffect or matchedTransitionSource
- Asks about reduce motion / animation accessibility
- Wants to sequence or chain animations
- Mentions withAnimation, animation completions, or Transaction
- Wants scroll-driven effects (parallax, carousels,
scrollTransition,visualEffect) - Mentions MeshGradient, TextRenderer, or Metal shader effects (
colorEffect,distortionEffect,layerEffect)
Decision Tree
Choose the right reference file based on what the user needs:
API Availability
Top 5 Mistakes — Quick Reference
Review Checklist
When reviewing animation code, verify:
- Reduce motion — animations respect
AccessibilityMotionEffectorUIAccessibility.isReduceMotionEnabled; provide non-motion alternatives - Duration limits — no animation exceeds ~0.5s for UI feedback; longer only for decorative/ambient effects
- Spring vs linear — springs for interactive/physical motion; linear/easeInOut only for opacity fades or progress indicators
- No deprecated APIs —
.animation(.spring())withoutvalue:is deprecated;.animation(nil)is replaced bywithTransaction - Correct spring generation — parameter names match the same API generation (never mix
responsewithbounce) - Completion handlers — using
withAnimation(_:completionCriteria:_:completion:)(iOS 17+), not inventing.onAnimationCompleted - Transition scope —
.transition()only affects views insideif/switchcontrolled by state; not for views that are always present - Per-frame closures stay cheap — KeyframeAnimator
contentclosures,visualEffectclosures,TextRenderer.draw, andAnimatableview bodies run every frame; no allocation, formatting, or layout math inside


