<!--
{
  "availability" : [
    "macOS: 10.15.1 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSDiffableDataSourceSnapshot-swift.struct/moveItem(_:beforeItem:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "s:6AppKit28NSDiffableDataSourceSnapshotV8moveItem_06beforeH0yq__q_tF"
  },
  "title" : "moveItem(_:beforeItem:)"
}
-->

# moveItem(_:beforeItem:)

Moves the item from its current position in the snapshot to the position immediately before the specified item.

```
mutating func moveItem(_ identifier: ItemIdentifierType, beforeItem toIdentifier: ItemIdentifierType)
```

## Parameters

`identifier`

The identifier of the item to move in the snapshot.

`toIdentifier`

The identifier of the item before which to move the specified item.

---

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)