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

# UISnapBehavior

A spring-like behavior whose initial motion is damped over time so that the object settles at a specific point.

```
@MainActor class UISnapBehavior
```

## 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.

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

1. Initialize a new snap behavior with the item using the [`init(item:snapTo:)`](/documentation/UIKit/UISnapBehavior/init(item:snapTo:)) 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 snap 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 snap behavior in a custom, composite behavior by starting with a [`UIDynamicBehavior`](/documentation/UIKit/UIDynamicBehavior) object and adding a snap behavior with the [`addChildBehavior(_:)`](/documentation/UIKit/UIDynamicBehavior/addChildBehavior(_:)) method.  If you want to influence a snap behavior at each step of a dynamic animation, implement the inherited [`action`](/documentation/UIKit/UIDynamicBehavior/action) method.

## Topics

### Initializing a snap behavior

[`-  initWithItem:snapToPoint:`](/documentation/UIKit/UISnapBehavior/init(item:snapTo:))

Initializes a snap behavior with a dynamic item and a snap point.

### Configuring a snap behavior

[`snapPoint`](/documentation/UIKit/UISnapBehavior/snapPoint)

The point to which to snap.

[`damping`](/documentation/UIKit/UISnapBehavior/damping)

The amount of oscillation of a dynamic item during the conclusion of a snap.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

### 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)