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

# indexOfItem(_:)

Returns the index of the item in the snapshot with the specified identifier.

```
func indexOfItem(_ identifier: ItemIdentifierType) -> Int?
```

## Parameters

`identifier`

The identifier of the item in the snapshot.

## Return Value

The index of the item in the snapshot, or `nil` if the item with the specified identifier doesn’t exist in the snapshot. This index value is 0-based.

---

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)