<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIDynamicAnimator/addBehavior(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIDynamicAnimator(im)addBehavior:"
  },
  "title" : "addBehavior(_:)"
}
-->

# addBehavior(_:)

Adds a dynamic behavior to a dynamic animator.

```
func addBehavior(_ behavior: UIDynamicBehavior)
```

## Parameters

`behavior`

The dynamic behavior instance you are adding.

    The dynamic animator ignores your use of this method if you:

- Provide a `nil` value
- Provide a behavior instance that you’ve already added to the animator at the same level in the behavior hierarchy
  
  > Important:
  > The dynamic animator raises an exception if you provide a behavior instance that you’ve already added to the animator at a different level in the behavior hierarchy.

---

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)