<!--
{
  "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/phaseAnimator(_:content:animation:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI4ViewPAAE13phaseAnimator_7content9animationQrqd_0__qd_1_AA018PlaceholderContentC0VyxG_qd__tcAA9AnimationVSgqd__ctSQRd__7ElementQyd_0_Rsd__STRd_0_AaBRd_1_r1_lF"
  },
  "title" : "phaseAnimator(_:content:animation:)"
}
-->

# phaseAnimator(_:content:animation:)

Animates effects that you apply to a view over a sequence of phases
that change continuously.

```
nonisolated func phaseAnimator<Phase>(_ phases: some Sequence, @ContentBuilder content: @escaping (PlaceholderContentView<Self>, Phase) -> some View, animation: @escaping (Phase) -> Animation? = { _ in .default }) -> some View where Phase : Equatable
```

## Parameters

`phases`

The sequence of phases to cycle through. Ensure that the
sequence isn’t empty. If it is, SwiftUI logs a runtime warning and
also returns a visual warning as the output view.

`content`

A content builder closure that takes two parameters: a proxy
value representing the modified view and the current phase.
You can apply effects to the proxy based on the current phase.

`animation`

A closure that takes the current phase as input. Return
the animation to use when transitioning to the next phase. If you
return `nil`, the transition doesn’t animate. If you don’t set this
parameter, SwiftUI uses a default animation.

## Discussion

When the modified view first appears, this modifier renders its
`content` closure using the first phase as input to the closure,
along with a proxy for the modified view. Apply effects to the
proxy — and thus to the modified view — in a way that’s appropriate
for the first phase value.

Right away, the modifier provides its `content` closure with the value
of the second phase. Update the effects that you apply to the proxy
view accordingly, and the modifier animates the change for you.
As soon as the animation completes, the procedure repeats using
successive phases until reaching the last phase, at which point the
modifier loops back to the first phase.

---

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)