<!--
{
  "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/UIDynamicItemBehavior",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIDynamicItemBehavior"
  },
  "title" : "UIDynamicItemBehavior"
}
-->

# UIDynamicItemBehavior

A base dynamic animation configuration for one or more dynamic items.

```
@MainActor class UIDynamicItemBehavior
```

## Overview

A *dynamic item* is any iOS or custom object that conforms to the [`UIDynamicItem`](/documentation/UIKit/UIDynamicItem) protocol. The [`UIView`](/documentation/UIKit/UIView) and [`UICollectionViewLayoutAttributes`](/documentation/UIKit/UICollectionViewLayoutAttributes) classes implement this protocol in iOS 7 and later. You can use a custom object as a dynamic item for such purposes as reacting to rotation or position changes computed by a dynamic animator—an instance of the [`UIDynamicAnimator`](/documentation/UIKit/UIDynamicAnimator) class.

One notable and common use of a dynamic item behavior is to confer a velocity to a dynamic item to match the ending velocity of a user gesture.

To use a dynamic item behavior with a dynamic item, perform these two steps:

1. Associate the item with the behavior using the [`addItem(_:)`](/documentation/UIKit/UIDynamicItemBehavior/addItem(_:)) method, or initialize a new dynamic item behavior with an array of items using the [`init(items:)`](/documentation/UIKit/UIDynamicItemBehavior/init(items:)) method
2. Enable the behavior by adding it to an animator using the [`addBehavior(_:)`](/documentation/UIKit/UIDynamicAnimator/addBehavior(_:)) method

The coordinate system that pertains to a dynamic item behavior, and the types of dynamic items you can use with the behavior, depend on how you initialized the associated animator. For details, see [`UIDynamicAnimator`](/documentation/UIKit/UIDynamicAnimator).

You can disable rotation for a dynamic item behavior’s items by returning <doc://com.apple.documentation/documentation/Swift/false> from the [`allowsRotation`](/documentation/UIKit/UIDynamicItemBehavior/allowsRotation) property. To configure interaction among the behavior’s items, use the [`elasticity`](/documentation/UIKit/UIDynamicItemBehavior/elasticity) and [`friction`](/documentation/UIKit/UIDynamicItemBehavior/friction) properties.

You can include a dynamic item behavior in a custom, composite behavior by starting with a [`UIDynamicBehavior`](/documentation/UIKit/UIDynamicBehavior) object and adding a dynamic item behavior with the [`addChildBehavior(_:)`](/documentation/UIKit/UIDynamicBehavior/addChildBehavior(_:)) method. If you want to influence a dynamic item behavior at each step of a dynamic animation, implement the inherited [`action`](/documentation/UIKit/UIDynamicBehavior/action) method.

If you add more than one dynamic item behavior to an animator, you effectively create a behavior tree. Only one configuration of a given property applies to any given dynamic item. For a property configured in more than one dynamic item behavior, the last one in the behavior tree, starting from the dynamic animator and going depth first toward the dynamic item, wins.

In the case of an animator with exactly one dynamic item behavior, you can restore default values for all dynamic item behavior properties by removing the behavior. In the case of an animator to which you’ve applied multiple dynamic item behaviors, removing one takes its property contribution out of the behavior tree.

## Topics

### Initializing and managing a dynamic item behavior

[`-  addItem:`](/documentation/UIKit/UIDynamicItemBehavior/addItem(_:))

Adds a dynamic item to the dynamic item behavior’s item array.

[`-  initWithItems:`](/documentation/UIKit/UIDynamicItemBehavior/init(items:))

Initializes a dynamic item behavior with an array of dynamic items.

[`-  removeItem:`](/documentation/UIKit/UIDynamicItemBehavior/removeItem(_:))

Removes a specific dynamic item from the dynamic item behavior.

[`items`](/documentation/UIKit/UIDynamicItemBehavior/items)

Returns the set of dynamic items you’ve added to the dynamic item behavior.

### Configuring a dynamic item behavior

[`-  addAngularVelocity:forItem:`](/documentation/UIKit/UIDynamicItemBehavior/addAngularVelocity(_:for:))

Adds a specified angular velocity to a dynamic item.

[`-  addLinearVelocity:forItem:`](/documentation/UIKit/UIDynamicItemBehavior/addLinearVelocity(_:for:))

Adds a specified linear velocity to a dynamic item.

[`allowsRotation`](/documentation/UIKit/UIDynamicItemBehavior/allowsRotation)

Specifies whether rotation is allowed for the behavior’s dynamic items.

[`angularResistance`](/documentation/UIKit/UIDynamicItemBehavior/angularResistance)

The angular resistance for the behavior’s dynamic items.

[`-  angularVelocityForItem:`](/documentation/UIKit/UIDynamicItemBehavior/angularVelocity(for:))

Returns the angular velocity for a specified dynamic item.

[`-  linearVelocityForItem:`](/documentation/UIKit/UIDynamicItemBehavior/linearVelocity(for:))

Returns the linear velocity for a specified dynamic item.

[`density`](/documentation/UIKit/UIDynamicItemBehavior/density)

The relative mass density of the behavior’s dynamic items.

[`elasticity`](/documentation/UIKit/UIDynamicItemBehavior/elasticity)

The amount of elasticity applied to collisions for the behavior’s dynamic items.

[`friction`](/documentation/UIKit/UIDynamicItemBehavior/friction)

The linear resistance for the behavior’s dynamic items when two slide against each other.

[`resistance`](/documentation/UIKit/UIDynamicItemBehavior/resistance)

The linear resistance for the behavior’s dynamic items, which reduces their linear velocity over time.

[`charge`](/documentation/UIKit/UIDynamicItemBehavior/charge)

The charge associated with the item.

[`anchored`](/documentation/UIKit/UIDynamicItemBehavior/isAnchored)

A Boolean value indicating whether the item is anchored to its current position.

## Relationships

### Inherits From

[`UIDynamicBehavior`](/documentation/UIKit/UIDynamicBehavior)

### Conforms To

[`CVarArg`](/documentation/Swift/CVarArg)

[`Equatable`](/documentation/Swift/Equatable)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Sendable`](/documentation/Swift/Sendable)

---

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)