---
title: "indexOfItem(_:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdiffabledatasourcesnapshot-swift.struct/indexofitem(_:)"
---

# indexOfItem(_:)

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

## Declaration

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

## Parameters

- `identifier`: The identifier of the item in the snapshot.

## Return Value

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.

## See Also

### Identifying Items and Sections

- [itemIdentifiers](appkit/nsdiffabledatasourcesnapshot-swift.struct/itemidentifiers.md)
- [sectionIdentifiers](appkit/nsdiffabledatasourcesnapshot-swift.struct/sectionidentifiers.md)
- [indexOfSection(_:)](appkit/nsdiffabledatasourcesnapshot-swift.struct/indexofsection(_:).md)
- [itemIdentifiers(inSection:)](appkit/nsdiffabledatasourcesnapshot-swift.struct/itemidentifiers(insection:).md)
- [sectionIdentifier(containingItem:)](appkit/nsdiffabledatasourcesnapshot-swift.struct/sectionidentifier(containingitem:).md)
