Instance Method

controller(_:didChange:atSectionIndex:for:)

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

Declaration

optional func controller(_ controller: NSFetchedResultsController<NSFetchRequestResult>, didChange sectionInfo: 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

func controllerWillChangeContent(NSFetchedResultsController<NSFetchRequestResult>)

Notifies the receiver that the fetched results controller is about to start processing of one or more changes due to an add, remove, move, or update.

func controllerDidChangeContent(NSFetchedResultsController<NSFetchRequestResult>)

Notifies the receiver that the fetched results controller has completed processing of one or more changes due to an add, remove, move, or update.