Contents

Animatable()

A member and extension macro that, when applied to a struct, class or enum declaration, synthesizes the conformance to Animatable and its requirement, the animatableData property using the existing animatable properties of the type this macro is applied to.

Declaration

@attached(extension, conformances: Animatable) @attached(member, names: named(animatableData)) macro Animatable()

Overview

@Animatable
struct CoolShape: Shape {
    var width: CGFloat
    var angle: Angle
    @AnimatableIgnored var isOpaque: Bool

    // ...
}

In the above code, animatableData will be synthesized using width and angle properties of CoolShape structure. Since changes to isOpaque property cannot be animated, it is annotated with @AnimatableIgnored.

See Also

Animating data