<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Animatable()",
  "metadataVersion" : "0.1.0",
  "role" : "Macro",
  "symbol" : {
    "kind" : "Macro",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI10Animatableyycfm"
  },
  "title" : "Animatable()"
}
-->

# 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.

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

## Overview

```swift
@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`.

> Note: The `@Animatable` macro will not generate an `Animatable` conformance if
> the type already conforms to `Animatable`.

> Note: It is only possible to attach
> `@Animatable` to types with properties.

> Note: `@Animatable` will not include computed properties in the
> synthesized `animatableData`.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)