swiftui-animation-ref

Reference SwiftUI animation interpolation, VectorArithmetic, Animatable, and the @Animatable macro.

1.1k|81|Updated Nov 30, 2025
One-click install
npx skills add https://github.com/CharlesWiltgen/Axiom --skill swiftui-animation-ref
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: swiftui-animation-ref
Source: https://github.com/CharlesWiltgen/Axiom/tree/main/.claude-plugin/plugins/axiom/skills/swiftui-animation-ref
Command: npx skills add https://github.com/CharlesWiltgen/Axiom --skill swiftui-animation-ref

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Textbook reference for SwiftUI animation system, Animatable protocol, and @Animatable macro (iOS 26).

Core Features & Use Cases

  • Understanding VectorArithmetic and interpolation
  • Animatable protocol and how to animate properties
  • Differences between model and presentation values
  • How to use spring vs timing curve animations and the @Animatable macro

Quick Start

Explain how to use the Animatable protocol to animate a custom view's property.

Frequently Asked Questions about swiftui-animation-ref

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I animate custom properties in SwiftUI that don't animate by default?

Conform your view to the Animatable protocol and define animatableData using VectorArithmetic. This tells SwiftUI how to interpolate your custom property during animations, enabling smooth transitions for types like Int, CGPoint, or custom structs.

What's the difference between model values and presentation values in SwiftUI animations?

Model values are your source of truth and don't change during animation; presentation values reflect the interpolated state displayed on screen. Understanding this distinction is critical for debugging animations and ensuring your logic responds to the correct value.

How do I choose between spring and timing curve animations in SwiftUI?

Spring animations create natural, physics-based motion with bounce and decay; timing curves provide precise, predictable easing. Use spring for interactive UI feedback and timing curves for controlled, linear transitions or specific pacing requirements.

What is VectorArithmetic and why do I need it to animate custom types?

VectorArithmetic is a protocol that defines how SwiftUI interpolates between values during animation. It requires conforming types to support addition, subtraction, and scalar multiplication, enabling smooth transitions for any custom data structure.

Can I use the @Animatable macro, and what iOS versions support it?

The @Animatable macro is available in iOS 26 and later, providing a simplified way to make properties animatable without manually implementing the Animatable protocol. For earlier iOS versions, implement Animatable and animatableData directly.

Why aren't my Int or String properties animating in SwiftUI?

SwiftUI only animates types that conform to VectorArithmetic. Int and String don't conform by default. Wrap them in an Animatable-conforming type or use animatableData to map them to an animatable representation like Double or CGFloat.