Deprecated rollback() on async and sync transactions. Added undo utilities to unsafe transactions.

This commit is contained in:
John Rommel Estropia
2015-11-14 20:00:40 +09:00
parent 05b4a7092a
commit 0c0a2a382c
5 changed files with 44 additions and 23 deletions

View File

@@ -186,21 +186,6 @@ public /*abstract*/ class BaseDataTransaction {
objects.forEach { context.fetchExisting($0)?.deleteFromContext() }
}
// MARK: Saving changes
/**
Rolls back the transaction by resetting the `NSManagedObjectContext`. After calling this method, all `NSManagedObjects` fetched within the transaction will become invalid.
*/
public func rollback() {
CoreStore.assert(
self.bypassesQueueing || self.transactionQueue.isCurrentExecutionContext(),
"Attempted to rollback a \(typeName(self)) outside its designated queue."
)
self.context.reset()
}
// MARK: Internal