---
title: "dropDestination(for:action:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/dynamicviewcontent/dropdestination(for:action:)"
---

# dropDestination(for:action:)

Sets the insert action for the dynamic view.

## Declaration

```swift
nonisolated func dropDestination<T>(for payloadType: T.Type = T.self, action: @escaping ([T], Int) -> Void) -> some DynamicViewContent where T : Transferable

```

## Parameters

- `payloadType`: Type of the models that are dropped.
- `action`: A closure that SwiftUI invokes when elements are added to the view. The closure takes two arguments: The first argument is the offset relative to the dynamic view’s underlying collection of data. The second argument is an array of Transferable items that represents the data that you want to insert.

## Return Value

Return Value A view that calls action when elements are inserted into the original view.

## Discussion

Discussion struct Profile: Identifiable {     let givenName: String     let familyName: String     let id = UUID() }

@State private var profiles: [Profile] = [     Person(givenName: "Juan", familyName: "Chavez"),     Person(givenName: "Mei", familyName: "Chen"),     Person(givenName: "Tom", familyName: "Clark"),     Person(givenName: "Gita", familyName: "Kumar") ]

var body: some View {     List {         ForEach(profiles) { profile in             Text(profile.givenName)         }         .dropDestination(for: Profile.self) { receivedProfiles, offset in             profiles.insert(contentsOf: receivedProfiles, at: offset)         }     } }

## See Also

### Responding to updates

- [onDelete(perform:)](swiftui/dynamicviewcontent/ondelete(perform:).md)
- [onInsert(of:perform:)](swiftui/dynamicviewcontent/oninsert(of:perform:).md)
- [onMove(perform:)](swiftui/dynamicviewcontent/onmove(perform:).md)
