<!--
{
  "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/View/keyframeAnimator(initialValue:repeating:content:keyframes:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE16keyframeAnimator12initialValue9repeating7content9keyframesQrqd___Sbqd_0_AA018PlaceholderContentC0VyxG_qd__tYbcqd_1_qd__ct0G0Qyd_1_Rsd__AaBRd_0_AA9KeyframesRd_1_r1_lF"
  },
  "title" : "keyframeAnimator(initialValue:repeating:content:keyframes:)"
}
-->

# keyframeAnimator(initialValue:repeating:content:keyframes:)

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

```
nonisolated func keyframeAnimator<Value>(initialValue: Value, repeating: Bool = true, @ContentBuilder content: @escaping @Sendable (PlaceholderContentView<Self>, Value) -> some View, @KeyframesBuilder<Value> keyframes: @escaping (Value) -> some Keyframes) -> some View
```

## Parameters

`initialValue`

The initial value that the keyframes will animate
from.

`repeating`

Whether the keyframes are currently repeating. If false,
the value at the beginning of the keyframe timeline will be
provided to the content closure.

`content`

A content builder closure that takes two parameters. The first
parameter is a proxy value representing the modified view. The
second parameter is the interpolated value generated by the
keyframes.

`keyframes`

Keyframes defining how the value changes over time. The
current value of the animator is the single argument, which is
equal to `initialValue` when the view first appears, then is equal
to the end value of the previous keyframe animation on subsequent
calls.

## Discussion

Note that the `content` closure will be updated on every frame while
animating, so avoid performing any expensive operations directly within
`content`.

---

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)