Contents

controller(_:didChange:atSectionIndex:for:)

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

Declaration

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 Insert and 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.

See Also

Responding to Changes