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

# UIPushBehavior

A behavior that applies a continuous or instantaneous force to one or more dynamic items, causing those items to change position accordingly.

```
@MainActor class UIPushBehavior
```

## 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 starting in iOS 7.0. 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.

The default magnitude of a push behavior’s force vector is `nil`, equivalent to no force. A continuous force vector with a magnitude of `1.0`, applied to a 100 point x 100 point view whose density value is `1.0`, results in view acceleration of 100 points / second² in the direction of the vector; this value is also known as the UIKit Newton.

You express a push behavior’s force vector in terms of magnitude ([`magnitude`](/documentation/UIKit/UIPushBehavior/magnitude)) and radian angle ([`angle`](/documentation/UIKit/UIPushBehavior/angle)). Instead of using radian angle, you can equivalently express direction using *x* and *y* components by using the [`pushDirection`](/documentation/UIKit/UIPushBehavior/pushDirection) property. Whichever approach you use, the alternate, equivalent values update automatically.

For each dynamic item that you associate with a push, the force is applied at the item center or at a specified offset from the center in item-relative coordinates.

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

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

After enabling a push behavior, you can activate it and deactivate it using the [`active`](/documentation/UIKit/UIPushBehavior/active) property.

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

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

## Topics

### Initializing and managing a push behavior

[`active`](/documentation/UIKit/UIPushBehavior/active)

The state of the push behavior’s force: either active or inactive.

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

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

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

Initializes a push behavior with an array of dynamic items.

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

Removes a specific dynamic item from the behavior.

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

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

### Configuring a push behavior

[`-  setAngle:magnitude:`](/documentation/UIKit/UIPushBehavior/setAngle(_:magnitude:))

Sets the angle and magnitude of the force vector for the behavior.

[`angle`](/documentation/UIKit/UIPushBehavior/angle)

The angle, in radians, of the force vector for the behavior.

[`magnitude`](/documentation/UIKit/UIPushBehavior/magnitude)

The magnitude of the force vector for the push behavior.

[`mode`](/documentation/UIKit/UIPushBehavior/mode-swift.property)

Returns the force mode for the push behavior.

[`-  setTargetOffsetFromCenter:forItem:`](/documentation/UIKit/UIPushBehavior/setTargetOffsetFromCenter(_:for:))

Sets the offset, from the center of a dynamic item, at which to apply the push behavior’s force vector.

[`-  targetOffsetFromCenterForItem:`](/documentation/UIKit/UIPushBehavior/targetOffsetFromCenter(for:))

Returns the offset, from the center of a dynamic item, at which the push behavior’s force vector is applied.

[`pushDirection`](/documentation/UIKit/UIPushBehavior/pushDirection)

The direction of the force vector for the behavior, expressed as *x* and *y* components and using standard UIKit geometry.

### Constants

[`Mode`](/documentation/UIKit/UIPushBehavior/Mode-swift.enum)

The type of force for the push behavior.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

### Inherits From

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

---

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)