---
title: "modifyAnimations(withRepeatCount:autoreverses:animations:)"
framework: uikit
role: symbol
role_heading: Type Method
path: "uikit/uiview/modifyanimations(withrepeatcount:autoreverses:animations:)"
---

# modifyAnimations(withRepeatCount:autoreverses:animations:)

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

## Declaration

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

Discussion You must call this method from within an enclosing animation block. The inverse nesting, calling animate(withDuration:animations:) from inside the modifyAnimations(withRepeatCount:autoreverses:animations:) block, doesn’t work. UIView.animate(withDuration: 1.0) {     UIView.modifyAnimations(withRepeatCount: 2, autoreverses: true) {         // Set view properties.     } }

## See Also

### Animating views

- [animate(_:changes:completion:)](uikit/uiview/animate(_:changes:completion:).md)
- [animate(springDuration:bounce:initialSpringVelocity:delay:options:animations:completion:)](uikit/uiview/animate(springduration:bounce:initialspringvelocity:delay:options:animations:completion:).md)
- [animate(withDuration:delay:options:animations:completion:)](uikit/uiview/animate(withduration:delay:options:animations:completion:).md)
- [animate(withDuration:animations:completion:)](uikit/uiview/animate(withduration:animations:completion:).md)
- [animate(withDuration:animations:)](uikit/uiview/animate(withduration:animations:).md)
- [transition(with:duration:options:animations:completion:)](uikit/uiview/transition(with:duration:options:animations:completion:).md)
- [transition(from:to:duration:options:completion:)](uikit/uiview/transition(from:to:duration:options:completion:).md)
- [animateKeyframes(withDuration:delay:options:animations:completion:)](uikit/uiview/animatekeyframes(withduration:delay:options:animations:completion:).md)
- [addKeyframe(withRelativeStartTime:relativeDuration:animations:)](uikit/uiview/addkeyframe(withrelativestarttime:relativeduration:animations:).md)
- [perform(_:on:options:animations:completion:)](uikit/uiview/perform(_:on:options:animations:completion:).md)
- [animate(withDuration:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:)](uikit/uiview/animate(withduration:delay:usingspringwithdamping:initialspringvelocity:options:animations:completion:).md)
- [performWithoutAnimation(_:)](uikit/uiview/performwithoutanimation(_:).md)
