ListSectionObserver
@available(OSX 10.12, *)
public protocol ListSectionObserver : ListObjectObserver
Implement the ListSectionObserver
protocol to observe changes to a list’s section info. ListSectionObserver
s may register themselves to a ListMonitor
‘s addObserver(_:)
method:
let monitor = CoreStore.monitorSectionedList(
From<MyPersonEntity>(),
SectionBy("age") { "Age \($0)" },
OrderBy(.ascending("lastName"))
)
monitor.addObserver(self)
-
listMonitor(_:didInsertSection:toSectionIndex:)
Default implementationNotifies 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
monitor
the
ListMonitor
monitoring the list being observedsectionInfo
the
NSFetchedResultsSectionInfo
for the inserted sectionsectionIndex
the new section index for the new section
-
listMonitor(_:didDeleteSection:fromSectionIndex:)
Default implementationNotifies 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
monitor
the
ListMonitor
monitoring the list being observedsectionInfo
the
NSFetchedResultsSectionInfo
for the deleted sectionsectionIndex
the previous section index for the deleted section