<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/DynamicTableRowContent/dropDestination(for:action:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI22DynamicTableRowContentPAAE15dropDestination3for6actionAA08ModifiedF0VyxAA08OnInsertdE8ModifierVGqd__m_ySi_Sayqd__Gtct16CoreTransferable0P0Rd__lF"
  },
  "title" : "dropDestination(for:action:)"
}
-->

# dropDestination(for:action:)

Sets the insert action for the dynamic table rows.

```
func dropDestination<T>(for payloadType: T.Type = T.self, action: @escaping (Int, [T]) -> Void) -> ModifiedContent<Self, OnInsertTableRowModifier> where T : Transferable
```

## Parameters

`payloadType`

Type of the models that are dropped.

`action`

A closure that SwiftUI invokes when elements are added to
the collection of rows.
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

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

## 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 {
    Table {
        TableColumn("Given Name", value: \.givenName)
        TableColumn("Family Name", value: \.familyName)
    } rows: {
        ForEach(profiles) {
            TableRow($0)
        }
        .dropDestination(
            for: Profile.self
        ) { offset, receivedProfiles in
            people.insert(contentsOf: receivedProfiles, at: offset)
        }
    }
}
```

---

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)