<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIView/modifyAnimations(withRepeatCount:autoreverses:animations:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIView(cm)modifyAnimationsWithRepeatCount:autoreverses:animations:"
  },
  "title" : "modifyAnimations(withRepeatCount:autoreverses:animations:)"
}
-->

# modifyAnimations(withRepeatCount:autoreverses:animations:)

Repeats the specified animations a specific number of times, optionally running the animation forward and backward.

```
class func modifyAnimations(withRepeatCount count: CGFloat, autoreverses: Bool, animations: () -> Void)
```

## Parameters

`count`

The number of times to repeat the animations.

`autoreverses`

A Boolean value that indicates whether the animations run forward and backward.

`animations`

The animations to perform.

## Discussion

You must call this method from within an enclosing animation block. The inverse nesting, calling [`animate(withDuration:animations:)`](/documentation/UIKit/UIView/animate(withDuration:animations:)) from inside the [`modifyAnimations(withRepeatCount:autoreverses:animations:)`](/documentation/UIKit/UIView/modifyAnimations(withRepeatCount:autoreverses:animations:)) block, doesn’t work.

```swift
UIView.animate(withDuration: 1.0) {
    UIView.modifyAnimations(withRepeatCount: 2, autoreverses: true) {
        // Set view properties.
    }
}
```

---

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)