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

# indexOfSection(_:)

Returns the index of the section of the snapshot with the specified identifier.

```
func indexOfSection(_ identifier: SectionIdentifierType) -> Int?
```

## Parameters

`identifier`

The identifier of the section of the snapshot.

## Return Value

The index of the section of the snapshot, or `nil` if the section 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)