<!--
{
  "availability" : [
    "iOS: 2.0.0 - 13.0.0",
    "iPadOS: 2.0.0 - 13.0.0",
    "macCatalyst: 13.1.0 - 13.1.0",
    "tvOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIView/setAnimationWillStart(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIView(cm)setAnimationWillStartSelector:"
  },
  "title" : "setAnimationWillStart(_:)"
}
-->

# setAnimationWillStart(_:)

Sets the message to send to the animation delegate when the animation starts.

```
class func setAnimationWillStart(_ selector: Selector?)
```

## Parameters

`selector`

The message to send to the animation delegate before animations start. The default value is `NULL`. This selector should be of the form: `- (void)animationDidStart:(NSString *)animationID context:(void *)context`. Your method must take the following arguments:

- `animationID`

    An     <doc://com.apple.documentation/documentation/Foundation/NSString>     containing an optional application-supplied identifier. This is the identifier string that is passed to the [`beginAnimations(_:context:)`](/documentation/UIKit/UIView/beginAnimations(_:context:))     method. This argument can be     `nil`    .

- `context`

    An optional application-supplied context. This is the context data passed to the [`beginAnimations(_:context:)`](/documentation/UIKit/UIView/beginAnimations(_:context:))     method. This argument can be     `nil`    .

## Discussion

If you specify an animation delegate for a begin/commit set of animations, you use this method to specify the selector to call before the animations begin. This method does nothing if called from outside of an animation block. It must be called between calls to the [`beginAnimations(_:context:)`](/documentation/UIKit/UIView/beginAnimations(_:context:)) and [`commitAnimations()`](/documentation/UIKit/UIView/commitAnimations()) methods. This selector is set to `NULL` by default.

> Note:
> Your start selector is not called if animations are disabled.

Use of this method is discouraged in iOS 4.0 and later. If you are using the block-based animation methods, you can include your delegate’s start code directly inside your block.

---

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)