mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-24 18:31:17 +01:00
improved migrationchain validation
This commit is contained in:
@@ -78,6 +78,10 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to observe objects from \(typeName(self)) outside the main thread."
|
||||
)
|
||||
CoreStore.assert(
|
||||
fetchClauses.filter { $0 is OrderBy }.count > 0,
|
||||
"A ListMonitor requires an OrderBy clause."
|
||||
)
|
||||
|
||||
return ListMonitor(
|
||||
dataStack: self,
|
||||
@@ -114,6 +118,10 @@ public extension DataStack {
|
||||
NSThread.isMainThread(),
|
||||
"Attempted to observe objects from \(typeName(self)) outside the main thread."
|
||||
)
|
||||
CoreStore.assert(
|
||||
fetchClauses.filter { $0 is OrderBy }.count > 0,
|
||||
"A ListMonitor requires an OrderBy clause."
|
||||
)
|
||||
|
||||
return ListMonitor(
|
||||
dataStack: self,
|
||||
|
||||
@@ -500,21 +500,9 @@ public final class ListMonitor<T: NSManagedObject> {
|
||||
self.sectionIndexTransformer = { $0 }
|
||||
}
|
||||
|
||||
|
||||
fetchedResultsControllerDelegate.handler = self
|
||||
fetchedResultsControllerDelegate.fetchedResultsController = fetchedResultsController
|
||||
|
||||
do {
|
||||
|
||||
try fetchedResultsController.performFetch()
|
||||
}
|
||||
catch {
|
||||
|
||||
CoreStore.handleError(
|
||||
error as NSError,
|
||||
"Failed to perform fetch on \(typeName(NSFetchedResultsController))."
|
||||
)
|
||||
}
|
||||
try! fetchedResultsController.performFetch()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -202,19 +202,7 @@ public final class ObjectMonitor<T: NSManagedObject> {
|
||||
|
||||
fetchedResultsControllerDelegate.handler = self
|
||||
fetchedResultsControllerDelegate.fetchedResultsController = fetchedResultsController
|
||||
|
||||
|
||||
do {
|
||||
|
||||
try fetchedResultsController.performFetch()
|
||||
}
|
||||
catch {
|
||||
|
||||
CoreStore.handleError(
|
||||
error as NSError,
|
||||
"Failed to perform fetch for \(typeName(NSFetchedResultsController))."
|
||||
)
|
||||
}
|
||||
try! fetchedResultsController.performFetch()
|
||||
|
||||
self.lastCommittedAttributes = (self.object?.committedValuesForKeys(nil) as? [String: NSObject]) ?? [:]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user