<!--
{
  "availability" : [
    "iOS: 3.0.0 -",
    "iPadOS: 3.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreData",
  "identifier" : "/documentation/CoreData/NSFetchedResultsControllerDelegate/controller(_:didChange:atSectionIndex:for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Data"
    ],
    "preciseIdentifier" : "c:objc(pl)NSFetchedResultsControllerDelegate(im)controller:didChangeSection:atIndex:forChangeType:"
  },
  "title" : "controller(_:didChange:atSectionIndex:for:)"
}
-->

# controller(_:didChange:atSectionIndex:for:)

Notifies the receiver of the addition or removal of a section.

```
optional func controller(_ controller: NSFetchedResultsController<any NSFetchRequestResult>, didChange sectionInfo: any NSFetchedResultsSectionInfo, atSectionIndex sectionIndex: Int, for type: NSFetchedResultsChangeType)
```

## Parameters

`controller`

The fetched results controller that sent the message.

`sectionInfo`

The section that changed.

`sectionIndex`

The index of the changed section.

`type`

The type of change (insert or delete). Valid values are [`NSFetchedResultsChangeType.insert`](/documentation/CoreData/NSFetchedResultsChangeType/insert) and [`NSFetchedResultsChangeType.delete`](/documentation/CoreData/NSFetchedResultsChangeType/delete).

## Discussion

The fetched results controller reports changes to its section before changes to the fetched result objects.

### Special Considerations

This method may be invoked many times during an update event (for example, if you are importing data on a background thread and adding them to the context in a batch). You should consider carefully whether you want to update the table view on receipt of each message.

---

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)