---
title: "insertSections(_:beforeSection:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nsdiffabledatasourcesnapshot-swift.struct/insertsections(_:beforesection:)"
---

# insertSections(_:beforeSection:)

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

## Declaration

```swift
mutating func insertSections(_ identifiers: [SectionIdentifierType], beforeSection toIdentifier: SectionIdentifierType)
```

## Parameters

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

## See Also

### Inserting Items and Sections

- [insertItems(_:afterItem:)](appkit/nsdiffabledatasourcesnapshot-swift.struct/insertitems(_:afteritem:).md)
- [insertItems(_:beforeItem:)](appkit/nsdiffabledatasourcesnapshot-swift.struct/insertitems(_:beforeitem:).md)
- [insertSections(_:afterSection:)](appkit/nsdiffabledatasourcesnapshot-swift.struct/insertsections(_:aftersection:).md)
