---
title: "onMove(perform:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/dynamicviewcontent/onmove(perform:)"
---

# onMove(perform:)

Sets the move action for the dynamic view.

## Declaration

```swift
nonisolated func onMove(perform action: Optional<(IndexSet, Int) -> Void>) -> some DynamicViewContent

```

## Parameters

- `action`: A closure that SwiftUI invokes when elements in the dynamic view are moved. The closure takes two arguments that represent the offset relative to the dynamic view’s underlying collection of data. Pass nil to disable the ability to move items.

## Mentioned in

Making a view into a drag source

## Return Value

Return Value A view that calls action when elements are moved within the original view.

## See Also

### Responding to updates

- [onDelete(perform:)](swiftui/dynamicviewcontent/ondelete(perform:).md)
- [onInsert(of:perform:)](swiftui/dynamicviewcontent/oninsert(of:perform:).md)
- [dropDestination(for:action:)](swiftui/dynamicviewcontent/dropdestination(for:action:).md)
