# AsynchronousDataTransaction Class Reference

# AsynchronousDataTransaction

    public final class AsynchronousDataTransaction : BaseDataTransaction

The `AsynchronousDataTransaction` provides an interface for `DynamicObject` creates, updates, and deletes. A transaction object should typically be only used from within a transaction block initiated from `DataStack.perform(asynchronous:...)`, or from `CoreStore.perform(synchronous:...)`.

- `cancel()`

  Cancels a transaction by throwing `CoreStoreError.userCancelled`.

      try transaction.cancel()

  Important

  Never use `try?` or `try!` on a `cancel()` call. Always use `try`. Using `try?` will swallow the cancellation and the transaction will proceed to commit as normal. Using `try!` will crash the app as `cancel()` will always throw an error.

  #### Declaration

  Swift

      public func cancel() throws -> Never

### Result

- `Result`

  The `Result` contains the success or failure information for a completed transaction

  See more

  #### Declaration

  Swift

      public enum Result<T>

### BaseDataTransaction

- `create(_:)`

  Creates a new `NSManagedObject` or `CoreStoreObject` with the specified entity type.

  #### Declaration

  Swift

      public override func create<D>(_ into: Into<D>) -> D where D : DynamicObject

  #### Parameters

  `into` | the `Into` clause indicating the destination `NSManagedObject` or `CoreStoreObject` entity type and the destination configuration

  #### Return Value

  a new `NSManagedObject` or `CoreStoreObject` instance of the specified entity type.

- `edit(_:)`

  Returns an editable proxy of a specified `NSManagedObject` or `CoreStoreObject`.

  #### Declaration

  Swift

      public override func edit<D>(_ object: D?) -> D? where D : DynamicObject

  #### Parameters

  `object` | the `NSManagedObject` or `CoreStoreObject` to be edited

  #### Return Value

  an editable proxy for the specified `NSManagedObject` or `CoreStoreObject`.

- `edit(_:_:)`

  Returns an editable proxy of the object with the specified `NSManagedObjectID`.

  #### Declaration

  Swift

      public override func edit<D>(_ into: Into<D>, _ objectID: NSManagedObjectID) -> D? where D : DynamicObject

  #### Parameters

  `into` | an `Into` clause specifying the entity type
  `objectID` | the `NSManagedObjectID` for the object to be edited

  #### Return Value

  an editable proxy for the specified `NSManagedObject` or `CoreStoreObject`.

- `delete(_:)`

  Deletes a specified `NSManagedObject` or `CoreStoreObject`.

  #### Declaration

  Swift

      public override func delete<D>(_ object: D?) where D : DynamicObject

  #### Parameters

  `object` | the `NSManagedObject` or `CoreStoreObject` to be deleted

- `delete(_:_:_:)`

  Deletes the specified `DynamicObject`s.

  #### Declaration

  Swift

      public override func delete<D>(_ object1: D?, _ object2: D?, _ objects: D?...) where D : DynamicObject

  #### Parameters

  `object1` | the `DynamicObject` to be deleted
  `object2` | another `DynamicObject` to be deleted
  `objects` | other `DynamicObject`s to be deleted

- `delete(_:)`

  Deletes the specified `DynamicObject`s.

  #### Declaration

  Swift

      public override func delete<S>(_ objects: S) where S : Sequence, S.Element : DynamicObject

  #### Parameters

  `objects` | the `DynamicObject`s to be deleted

### CoreStoreSwiftType

- `bridgeToObjectiveC`

  #### Declaration

  Swift

      public var bridgeToObjectiveC: CSAsynchronousDataTransaction { get }

### CustomDebugStringConvertible

- `debugDescription`

  #### Declaration

  Swift

      public var debugDescription: String { get }