WIP: demo app

This commit is contained in:
John Rommel Estropia
2016-07-25 08:21:22 +09:00
parent db5b8ca702
commit e9be711d4c
61 changed files with 210 additions and 298 deletions

View File

@@ -311,10 +311,9 @@ public final class ListMonitor<T: NSManagedObject>: Hashable {
return nil
}
guard let sections = self.fetchedResultsController.sections
where section < sections.count else {
return nil
guard let sections = self.fetchedResultsController.sections, section < sections.count else {
return nil
}
return sections[section]
}
@@ -1105,8 +1104,8 @@ public final class ListMonitor<T: NSManagedObject>: Hashable {
self.isPersistentStoreChanging = true
guard let removedStores = (note.userInfo?[NSRemovedPersistentStoresKey] as? [NSPersistentStore]).flatMap(Set.init)
where !Set(self.fetchedResultsController.fetchRequest.affectedStores ?? []).intersection(removedStores).isEmpty else {
guard let removedStores = (note.userInfo?[NSRemovedPersistentStoresKey] as? [NSPersistentStore]).flatMap(Set.init),
!Set(self.fetchedResultsController.fetchRequest.affectedStores ?? []).intersection(removedStores).isEmpty else {
return
}

View File

@@ -341,7 +341,8 @@ extension ObjectMonitor: FetchedResultsControllerHandler {
userInfo: [String(NSManagedObject.self): anObject]
)
case .update:
case .update,
.move where indexPath == newIndexPath:
NotificationCenter.default.post(
name: Notification.Name.objectMonitorDidUpdateObject,
object: self,