mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-04-19 07:29:44 +02:00
Merge branch 'master' into corestore2_develop
# Conflicts: # CoreStore.podspec # Sources/Info.plist
This commit is contained in:
@@ -49,10 +49,6 @@ internal final class CoreStoreFetchedResultsController: NSFetchedResultsControll
|
|||||||
@nonobjc
|
@nonobjc
|
||||||
internal init<T: NSManagedObject>(context: NSManagedObjectContext, fetchRequest: NSFetchRequest, from: From<T>? = nil, sectionBy: SectionBy? = nil, applyFetchClauses: (fetchRequest: NSFetchRequest) -> Void) {
|
internal init<T: NSManagedObject>(context: NSManagedObjectContext, fetchRequest: NSFetchRequest, from: From<T>? = nil, sectionBy: SectionBy? = nil, applyFetchClauses: (fetchRequest: NSFetchRequest) -> Void) {
|
||||||
|
|
||||||
CoreStore.assert(
|
|
||||||
fetchClauses.filter { $0 is OrderBy }.count > 0,
|
|
||||||
"An \(typeName(NSFetchedResultsController)) requires an OrderBy clause."
|
|
||||||
)
|
|
||||||
from?.applyToFetchRequest(fetchRequest, context: context, applyAffectedStores: false)
|
from?.applyToFetchRequest(fetchRequest, context: context, applyAffectedStores: false)
|
||||||
applyFetchClauses(fetchRequest: fetchRequest)
|
applyFetchClauses(fetchRequest: fetchRequest)
|
||||||
|
|
||||||
|
|||||||
@@ -93,9 +93,9 @@ public final class UnsafeDataTransaction: BaseDataTransaction {
|
|||||||
- Important: Note that unlike `commit()`, `flush()` does not propagate/save updates to the `DataStack` and the persistent store. However, the flushed changes will be seen by children transactions created further from the current transaction (i.e. through `transaction.beginUnsafe()`)
|
- Important: Note that unlike `commit()`, `flush()` does not propagate/save updates to the `DataStack` and the persistent store. However, the flushed changes will be seen by children transactions created further from the current transaction (i.e. through `transaction.beginUnsafe()`)
|
||||||
- throws: an error thrown from `closure`, or an error thrown by Core Data (usually validation errors or conflict errors)
|
- throws: an error thrown from `closure`, or an error thrown by Core Data (usually validation errors or conflict errors)
|
||||||
*/
|
*/
|
||||||
public func flush() throws {
|
public func flush() {
|
||||||
|
|
||||||
try self.context.save()
|
self.context.processPendingChanges()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -105,10 +105,10 @@ public final class UnsafeDataTransaction: BaseDataTransaction {
|
|||||||
- parameter closure: the closure where changes can be made prior to the flush
|
- parameter closure: the closure where changes can be made prior to the flush
|
||||||
- throws: an error thrown from `closure`, or an error thrown by Core Data (usually validation errors or conflict errors)
|
- throws: an error thrown from `closure`, or an error thrown by Core Data (usually validation errors or conflict errors)
|
||||||
*/
|
*/
|
||||||
public func flush(@noescape closure: () throws -> Void) throws {
|
public func flush(@noescape closure: () throws -> Void) rethrows {
|
||||||
|
|
||||||
try closure()
|
try closure()
|
||||||
try self.context.save()
|
self.context.processPendingChanges()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user