---
title: "insertSections(withIdentifiers:beforeSectionWithIdentifier:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdiffabledatasourcesnapshotreference/insertsections(withidentifiers:beforesectionwithidentifier:)"
---

# insertSections(withIdentifiers:beforeSectionWithIdentifier:)

Inserts the provided sections immediately before the section with the specified identifier in the snapshot.

## Declaration

```swift
func insertSections(withIdentifiers sectionIdentifiers: [Any], beforeSectionWithIdentifier toSectionIdentifier: Any)
```

## Parameters

- `sectionIdentifiers`: The array of identifiers corresponding to the sections to add to the snapshot.
- `toSectionIdentifier`: The identifier of the section before which to insert the new sections.

## See Also

### Inserting items and sections

- [insertItems(withIdentifiers:afterItemWithIdentifier:)](appkit/nsdiffabledatasourcesnapshotreference/insertitems(withidentifiers:afteritemwithidentifier:).md)
- [insertItems(withIdentifiers:beforeItemWithIdentifier:)](appkit/nsdiffabledatasourcesnapshotreference/insertitems(withidentifiers:beforeitemwithidentifier:).md)
- [insertSections(withIdentifiers:afterSectionWithIdentifier:)](appkit/nsdiffabledatasourcesnapshotreference/insertsections(withidentifiers:aftersectionwithidentifier:).md)
