WIP: segfault

This commit is contained in:
John Rommel Estropia
2016-07-20 08:12:04 +09:00
parent f486ace437
commit 267c21063a
129 changed files with 2205 additions and 3282 deletions

View File

@@ -42,7 +42,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
- parameter completion: the block executed after the save completes. Success or failure is reported by the `SaveResult` argument of the block.
*/
public func commit(completion: (result: SaveResult) -> Void = { _ in }) {
public func commit(_ completion: (result: SaveResult) -> Void = { _ in }) {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
@@ -71,7 +71,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
- parameter closure: the block where creates, updates, and deletes can be made to the transaction. Transaction blocks are executed serially in a background queue, and all changes are made from a concurrent `NSManagedObjectContext`.
- returns: a `SaveResult` value indicating success or failure, or `nil` if the transaction was not comitted synchronously
*/
public func beginSynchronous(closure: (transaction: SynchronousDataTransaction) -> Void) -> SaveResult? {
public func beginSynchronous(_ closure: (transaction: SynchronousDataTransaction) -> Void) -> SaveResult? {
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
@@ -97,7 +97,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
- parameter into: the `Into` clause indicating the destination `NSManagedObject` entity type and the destination configuration
- returns: a new `NSManagedObject` instance of the specified entity type.
*/
public override func create<T: NSManagedObject>(into: Into<T>) -> T {
public override func create<T: NSManagedObject>(_ into: Into<T>) -> T {
CoreStore.assert(
!self.isCommitted,
@@ -114,7 +114,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
- returns: an editable proxy for the specified `NSManagedObject`.
*/
@warn_unused_result
public override func edit<T: NSManagedObject>(object: T?) -> T? {
public override func edit<T: NSManagedObject>(_ object: T?) -> T? {
CoreStore.assert(
!self.isCommitted,
@@ -132,7 +132,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
- returns: an editable proxy for the specified `NSManagedObject`.
*/
@warn_unused_result
public override func edit<T: NSManagedObject>(into: Into<T>, _ objectID: NSManagedObjectID) -> T? {
public override func edit<T: NSManagedObject>(_ into: Into<T>, _ objectID: NSManagedObjectID) -> T? {
CoreStore.assert(
!self.isCommitted,
@@ -147,7 +147,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
- parameter object: the `NSManagedObject` type to be deleted
*/
public override func delete(object: NSManagedObject?) {
public override func delete(_ object: NSManagedObject?) {
CoreStore.assert(
!self.isCommitted,
@@ -164,7 +164,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
- parameter object2: another `NSManagedObject` type to be deleted
- parameter objects: other `NSManagedObject`s type to be deleted
*/
public override func delete(object1: NSManagedObject?, _ object2: NSManagedObject?, _ objects: NSManagedObject?...) {
public override func delete(_ object1: NSManagedObject?, _ object2: NSManagedObject?, _ objects: NSManagedObject?...) {
CoreStore.assert(
!self.isCommitted,
@@ -179,7 +179,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
- parameter objects: the `NSManagedObject`s type to be deleted
*/
public override func delete<S: SequenceType where S.Generator.Element: NSManagedObject>(objects: S) {
public override func delete<S: Sequence where S.Iterator.Element: NSManagedObject>(_ objects: S) {
CoreStore.assert(
!self.isCommitted,
@@ -207,7 +207,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
if !self.isCommitted && self.hasChanges {
CoreStore.log(
.Warning,
.warning,
message: "The closure for the \(cs_typeName(self)) completed without being committed. All changes made within the transaction were discarded."
)
}
@@ -223,7 +223,7 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
if !self.isCommitted && self.hasChanges {
CoreStore.log(
.Warning,
.warning,
message: "The closure for the \(cs_typeName(self)) completed without being committed. All changes made within the transaction were discarded."
)
}
@@ -235,22 +235,4 @@ public final class AsynchronousDataTransaction: BaseDataTransaction {
// MARK: Private
private let closure: (transaction: AsynchronousDataTransaction) -> Void
// MARK: Deprecated
@available(*, deprecated=1.3.4, obsoleted=2.0.0, message="Resetting the context is inherently unsafe. This method will be removed in the near future. Use `beginUnsafe()` to create transactions with `undo` support.")
public func rollback() {
CoreStore.assert(
!self.isCommitted,
"Attempted to rollback an already committed \(cs_typeName(self))."
)
CoreStore.assert(
self.transactionQueue.isCurrentExecutionContext(),
"Attempted to rollback a \(cs_typeName(self)) outside its designated queue."
)
self.context.reset()
}
}