---
title: "reorderDestination(for:in:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/dropsession/reorderdestination(for:in:)"
---

# reorderDestination(for:in:)

Provides the destination value of a reordering operation that occurred in the container associated with this drop destination modifier.

## Declaration

```swift
nonisolated func reorderDestination<Item, CollectionID>(for item: Item.Type, in collectionID: CollectionID.Type = ReorderableSingleCollectionIdentifier.self) -> ReorderDifference<Item.ID, CollectionID>.Destination? where Item : Identifiable
```

## Mentioned in

Reordering items in lists, stacks, grids, and custom layouts

## Discussion

Discussion Use the ItemID and CollectionID types of your reorderContainer(for:in:isEnabled:move:) modifier to look up the destination value. This value can be nil, if the container was unable to determine a placement for the items. This can happen if the user drags items into the destination but does not interact with any of the container items to determine a concrete position. You should still accept these items into the container. In this example, those values are appended to the end of the collection: struct ContentView: View {     @State var contacts: [Contact] = []

var body: some View {         VStack {             ForEach(contacts) { contact in                 ContactView(contact)             }             .reorderable()         }         .reorderContainer(for: Contact.ID.self) { difference in             difference.apply(to: &contacts)         }         .dragContainer(for: Contact.self) { itemID in             contacts.first { $0.id == itemID }.map { [$0] } ?? []         }         .dropDestination(for: Contact.self) { items, session in             if let destinationIndex = session.reorderDestination(                 for: Contact.ID.self)?.index(in: contacts)             {                 contacts.insert(                     contentsOf: items, at: destinationIndex)             } else {                 contacts.append(contentsOf: items)             }         }     } } item: The type of reorderable items in the container. collectionID: The identifier type for collections in your container.

## See Also

### Reordering items

- [Making a card game with drag, drop, and reordering in SwiftUI](swiftui/making-a-card-game-with-drag-drop-and-reordering-in-swiftui.md)
- [reorderable()](swiftui/dynamicviewcontent/reorderable().md)
- [reorderable(collectionID:)](swiftui/dynamicviewcontent/reorderable(collectionid:).md)
- [ReorderableSingleCollectionIdentifier](swiftui/reorderablesinglecollectionidentifier.md)
- [reorderContainer(for:isEnabled:move:)](swiftui/view/reordercontainer(for:isenabled:move:).md)
- [reorderContainer(for:in:isEnabled:move:)](swiftui/view/reordercontainer(for:in:isenabled:move:).md)
- [reorderContainer(for:itemID:isEnabled:move:)](swiftui/view/reordercontainer(for:itemid:isenabled:move:).md)
- [reorderContainer(for:itemID:in:isEnabled:move:)](swiftui/view/reordercontainer(for:itemid:in:isenabled:move:).md)
- [reorderDestination(for:itemID:in:)](swiftui/dropsession/reorderdestination(for:itemid:in:).md)
- [ReorderDifference](swiftui/reorderdifference.md)
