<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: 17.0.0 -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/KeyframeAnimator",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI16KeyframeAnimatorV"
  },
  "title" : "KeyframeAnimator"
}
-->

# KeyframeAnimator

A container that animates its content with keyframes.

```
nonisolated struct KeyframeAnimator<Value, KeyframePath, Content> where Value == KeyframePath.Value, KeyframePath : Keyframes, Content : View
```

## Overview

The `content` closure updates every frame while
animating, so avoid performing any expensive operations directly within
`content`.

## Topics

### Creating a phase animator

[`init(initialValue:repeating:content:keyframes:)`](/documentation/SwiftUI/KeyframeAnimator/init(initialValue:repeating:content:keyframes:))

Loops the given keyframes continuously, updating
the view using the modifiers you apply in `body`.

[`init(initialValue:trigger:content:keyframes:)`](/documentation/SwiftUI/KeyframeAnimator/init(initialValue:trigger:content:keyframes:))

Plays the given keyframes when the given trigger value changes, updating
the view using the modifiers you apply in `body`.

## Relationships

### Conforms To

[`View`](/documentation/SwiftUI/View)

---

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)