Allow unsafe transactions to save synchronously

This commit is contained in:
John Estropia
2016-02-25 15:04:05 +09:00
parent 6e88b14237
commit 15353268e2
4 changed files with 23 additions and 3 deletions

View File

@@ -55,6 +55,17 @@ public final class UnsafeDataTransaction: BaseDataTransaction {
}
}
/**
Saves the transaction changes and waits for completion synchronously. For a `UnsafeDataTransaction`, multiple commits are allowed, although it is the developer's responsibility to ensure a reasonable leeway to prevent blocking the main thread.
- returns: a `SaveResult` containing the success or failure information
*/
public func commitAndWait() -> SaveResult {
self.result = self.context.saveSynchronously()
return self.result
}
/**
Rolls back the transaction.
*/