<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -",
    "macOS: 27.0.0 -",
    "visionOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/DropSession/reorderDestination(for:in:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI11DropSessionV18reorderDestination3for2inAA17ReorderDifferenceV0F0Vy2IDQzq__GSgxm_q_mts12IdentifiableRzr0_lF"
  },
  "title" : "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.

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

## Parameters

`item`

The type of reorderable items in the container.

`collectionID`

The identifier type for collections in your container.

## Discussion

Use the `ItemID` and `CollectionID` types of your
[`reorderContainer(for:in:isEnabled:move:)`](/documentation/SwiftUI/View/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 someone 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. The following example demonstrates appending those
values 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
            apply(difference: difference)
        }
        .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)
            }
        }
    }
}
```

---

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)