<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UIFieldBehavior",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UIFieldBehavior"
  },
  "title" : "UIFieldBehavior"
}
-->

# UIFieldBehavior

An object that applies field-based physics to dynamic items.

```
@MainActor class UIFieldBehavior
```

## Overview

A field behavior defines an area in which forces such as gravity, magnetism, drag, velocity, turbulence, and others can be applied. After creating a field behavior object of the appropriate type, configure the strength of the intended force along with any other field attributes.

After creating a field behavior object, call the [`addItem(_:)`](/documentation/UIKit/UIFieldBehavior/addItem(_:)) method to associate the field with that item. For many types of fields, you must also configure a [`UIDynamicItemBehavior`](/documentation/UIKit/UIDynamicItemBehavior) object for the item to define relevant attributes of the item such as its density (mass) or charge. After configuring the field, add it to the [`UIDynamicAnimator`](/documentation/UIKit/UIDynamicAnimator) object associated with your interface to begin the animations.

The [`position`](/documentation/UIKit/UIFieldBehavior/position) of a field defines its location in your interface and the field’s [`region`](/documentation/UIKit/UIFieldBehavior/region) defines its area of influence. The region you specify is centered on the field’s position. Regions can be circular or rectangular, and you can combine regions in different ways to create more complex region shapes.

Most fields use only a subset of the field attributes in their computations. All fields have a [`strength`](/documentation/UIKit/UIFieldBehavior/strength) value that helps define the intensity of the field. Most fields also use the [`falloff`](/documentation/UIKit/UIFieldBehavior/falloff) property to vary the field strength over distance. You configure other attributes only as needed for the type of field.

## Topics

### Getting the field behaviors

[`+  dragField`](/documentation/UIKit/UIFieldBehavior/dragField())

Creates and returns a field behavior for slowing an object’s velocity.

[`+  springField`](/documentation/UIKit/UIFieldBehavior/springField())

Creates and returns a spring field behavior.

[`+  velocityFieldWithVector:`](/documentation/UIKit/UIFieldBehavior/velocityField(direction:))

Creates and returns a field behavior object that applies a directional velocity to items.

[`+  electricField`](/documentation/UIKit/UIFieldBehavior/electricField())

Creates and returns a field behavior object that interacts with charged items.

[`+  magneticField`](/documentation/UIKit/UIFieldBehavior/magneticField())

Creates and returns a field behavior that interacts with charged items.

[`+  radialGravityFieldWithPosition:`](/documentation/UIKit/UIFieldBehavior/radialGravityField(position:))

Creates and returns a field behavior object that models a radial gravitational force.

[`+  linearGravityFieldWithVector:`](/documentation/UIKit/UIFieldBehavior/linearGravityField(direction:))

Creates and returns a field behavior object that models a linear gravitational force.

[`+  vortexField`](/documentation/UIKit/UIFieldBehavior/vortexField())

Creates and returns a field behavior object that applies a rotational force relative to the field’s position.

[`+  noiseFieldWithSmoothness:animationSpeed:`](/documentation/UIKit/UIFieldBehavior/noiseField(smoothness:animationSpeed:))

Creates and returns a field behavior object that applies random noise to other forces.

[`+  turbulenceFieldWithSmoothness:animationSpeed:`](/documentation/UIKit/UIFieldBehavior/turbulenceField(smoothness:animationSpeed:))

Creates and returns a field behavior object that applies noise to an item in motion.

[`+  fieldWithEvaluationBlock:`](/documentation/UIKit/UIFieldBehavior/field(evaluationBlock:))

Creates and returns a field behavior object that applies an app-specified field to items.

### Managing the associated dynamic items

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

Associates the field behavior with the specified dynamic item.

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

Removes the field behavior from the specified dynamic item.

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

The dynamic items associated with the current field behavior.

### Configuring the field attributes

[`position`](/documentation/UIKit/UIFieldBehavior/position)

The position of the field in the reference coordinate system.

[`region`](/documentation/UIKit/UIFieldBehavior/region)

The shape of the field.

[`strength`](/documentation/UIKit/UIFieldBehavior/strength)

The strength of the field.

[`falloff`](/documentation/UIKit/UIFieldBehavior/falloff)

The rate of decay for the field strength.

[`minimumRadius`](/documentation/UIKit/UIFieldBehavior/minimumRadius)

The minimum distance at which to start calculating new values for the field.

[`direction`](/documentation/UIKit/UIFieldBehavior/direction)

The direction of motion for a linear field.

[`smoothness`](/documentation/UIKit/UIFieldBehavior/smoothness)

The smoothness of the noise used to generate the field.

[`animationSpeed`](/documentation/UIKit/UIFieldBehavior/animationSpeed)

The rate at which the animation should proceed.

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

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