---
title: "velocityField(direction:)"
framework: uikit
role: symbol
role_heading: Type Method
path: "uikit/uifieldbehavior/velocityfield(direction:)"
---

# velocityField(direction:)

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

## Declaration

```swift
class func velocityField(direction: CGVector) -> Self
```

## Parameters

- `direction`: The vector indicating the direction of the velocity force. You can change this value later by modifying the doc://com.apple.uikit/documentation/UIKit/UIFieldBehavior/direction property.

## Return Value

Return Value A field behavior object that applies a velocity to items.

## Discussion

Discussion Velocity fields apply their velocity to the item, overriding any other acceleration forces currently on the item. The vector in the direction parameter is combined with the field strength to determine the velocity of items in the field.

## See Also

### Getting the field behaviors

- [dragField()](uikit/uifieldbehavior/dragfield().md)
- [springField()](uikit/uifieldbehavior/springfield().md)
- [electricField()](uikit/uifieldbehavior/electricfield().md)
- [magneticField()](uikit/uifieldbehavior/magneticfield().md)
- [radialGravityField(position:)](uikit/uifieldbehavior/radialgravityfield(position:).md)
- [linearGravityField(direction:)](uikit/uifieldbehavior/lineargravityfield(direction:).md)
- [vortexField()](uikit/uifieldbehavior/vortexfield().md)
- [noiseField(smoothness:animationSpeed:)](uikit/uifieldbehavior/noisefield(smoothness:animationspeed:).md)
- [turbulenceField(smoothness:animationSpeed:)](uikit/uifieldbehavior/turbulencefield(smoothness:animationspeed:).md)
- [field(evaluationBlock:)](uikit/uifieldbehavior/field(evaluationblock:).md)
