---
title: "reorderContainer(for:isEnabled:move:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/reordercontainer(for:isenabled:move:)"
---

# reorderContainer(for:isEnabled:move:)

Defines a container that allows its items to be reordered.

## Declaration

```swift
nonisolated func reorderContainer<Item>(for item: Item.Type, isEnabled: Bool = true, move: @escaping (ReorderDifference<Item.ID, ReorderableSingleCollectionIdentifier>) -> ()) -> some View where Item : Identifiable, Item.ID : Sendable

```

## Mentioned in

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

## Discussion

Discussion Declare this modifier on your container or layout view to make it a reorderable container. Then, apply reorderable(collectionID:) to the content of your container to make those items reorderable. Use this overload if your container only has one collection within it. If you have multiple collections of reorderable items, use reorderContainer(for:in:isEnabled:move:) and provide a type for collection identifiers. A reorderable item within the container can be lifted using a drag gesture. As that item lifts, a placeholder view will take its place to indicate where the moved view will be when dropped. As your user moves the item through the container, the position of the placeholder will update to be the last item that your user dragged over. When they drop the item, the move closure will be called with the change provided. The change is provided as a difference to the closure. The difference contains the identifiers of the moved items, in the order that the user selected them. It also contains a destination value, which indicates where to insert the item. If your single collection conforms to MutableCollection, you can use the difference’s ReorderDifference/apply(to:) method to apply the change directly to your closure. This example shows a list of landmarks. Items can be moved within the view’s underlying collection. struct ContentView: View {     @State private var landmarks: [Landmark] = []

var body: some View {         VStack {             ForEach(landmarks) { landmark in                 LandmarkView(landmark)             }             .reorderable()         }         .reorderContainer(for: Landmark.self) { difference in             difference.apply(to: &landmarks)         }     } } item: The type of reorderable items in the container. isEnabled: Whether the container allows reordering. move: A closure that provides the change at the end of a session.

## 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: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:in:)](swiftui/dropsession/reorderdestination(for:in:).md)
- [reorderDestination(for:itemID:in:)](swiftui/dropsession/reorderdestination(for:itemid:in:).md)
- [ReorderDifference](swiftui/reorderdifference.md)
