ListSectionObserver
public protocol ListSectionObserver : ListObjectObserver
Implement the ListSectionObserver protocol to observe changes to a list’s section info. ListSectionObservers may register themselves to a ListMonitor‘s addObserver(_:) method:
let monitor = dataStack.monitorSectionedList(
From<MyPersonEntity>(),
SectionBy("age") { "Age \($0)" },
OrderBy(.ascending("lastName"))
)
monitor.addObserver(self)
-
listMonitor(_:Default implementationdidInsertSection: toSectionIndex: sourceIdentifier: ) Notifies that a section was inserted at the specified index. (Optional) The default implementation does nothing.
Default Implementation
Declaration
Swift
func listMonitor( _ monitor: ListMonitor<ListEntityType>, didInsertSection sectionInfo: NSFetchedResultsSectionInfo, toSectionIndex sectionIndex: Int, sourceIdentifier: Any? )Parameters
monitorthe
ListMonitormonitoring the list being observedsectionInfothe
NSFetchedResultsSectionInfofor the inserted sectionsectionIndexthe new section index for the new section
sourceIdentifieran optional identifier provided by the transaction source
-
listMonitor(_:Default implementationdidInsertSection: toSectionIndex: ) Notifies that a section was inserted at the specified index. (Optional) The default implementation does nothing.
Default Implementation
Declaration
Swift
func listMonitor( _ monitor: ListMonitor<ListEntityType>, didInsertSection sectionInfo: NSFetchedResultsSectionInfo, toSectionIndex sectionIndex: Int )Parameters
monitorthe
ListMonitormonitoring the list being observedsectionInfothe
NSFetchedResultsSectionInfofor the inserted sectionsectionIndexthe new section index for the new section
-
listMonitor(_:Default implementationdidDeleteSection: fromSectionIndex: sourceIdentifier: ) Notifies that a section was inserted at the specified index. (Optional) The default implementation does nothing.
Default Implementation
Declaration
Swift
func listMonitor( _ monitor: ListMonitor<ListEntityType>, didDeleteSection sectionInfo: NSFetchedResultsSectionInfo, fromSectionIndex sectionIndex: Int, sourceIdentifier: Any? )Parameters
monitorthe
ListMonitormonitoring the list being observedsectionInfothe
NSFetchedResultsSectionInfofor the deleted sectionsectionIndexthe previous section index for the deleted section
sourceIdentifieran optional identifier provided by the transaction source
-
listMonitor(_:Default implementationdidDeleteSection: fromSectionIndex: ) Notifies that a section was inserted at the specified index. (Optional) The default implementation does nothing.
Default Implementation
Declaration
Swift
func listMonitor( _ monitor: ListMonitor<ListEntityType>, didDeleteSection sectionInfo: NSFetchedResultsSectionInfo, fromSectionIndex sectionIndex: Int )Parameters
monitorthe
ListMonitormonitoring the list being observedsectionInfothe
NSFetchedResultsSectionInfofor the deleted sectionsectionIndexthe previous section index for the deleted section
View on GitHub
ListSectionObserver Protocol Reference