<!--
{
  "availability" : [
    "macOS: 10.7.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSAnimationContext/completionHandler",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSAnimationContext(py)completionHandler"
  },
  "title" : "completionHandler"
}
-->

# completionHandler

A completion Block that is called when the animations in the grouping are completed.

```
var completionHandler: (() -> Void)? { get set }
```

## Discussion

If set to a non-`nil` value, a context’s `completionHandler` is guaranteed to be called on the main thread as soon as all animations subsequently added to the current `NSAnimationContext` grouping have completed or been cancelled.

This method drives the underlying `CATransaction`<doc://com.apple.documentation/documentation/QuartzCore/CATransaction/completionBlock()> property, although the Application Kit may assign a different, intermediary `completionBlock` to the current `CATransaction`.

The completion handler waits for all animations to which the handler applies, independent of whether they are evaluated by the Application Kit or delegated to Core Animation for evaluation in the render tree before firing.

If no animations are added before the current grouping is ended—or the completionHandler is set to a different value—the handler will be invoked immediately.

---

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)