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:...).
-
Cancels a transaction by throwing
CoreStoreError.userCancelled.try transaction.cancel()Important
Never usetry?ortry!on acancel()call. Always usetry. Usingtry?will swallow the cancellation and the transaction will proceed to commit as normal. Usingtry!will crash the app ascancel()will always throw an error.Declaration
Swift
public func cancel() throws -> Never
-
The
See moreResultcontains the success or failure information for a completed transactionDeclaration
Swift
public enum Result<T>
-
Creates a new
NSManagedObjectorCoreStoreObjectwith the specified entity type.Declaration
Swift
public override func create<D>(_ into: Into<D>) -> D where D : DynamicObjectParameters
intothe
Intoclause indicating the destinationNSManagedObjectorCoreStoreObjectentity type and the destination configurationReturn Value
a new
NSManagedObjectorCoreStoreObjectinstance of the specified entity type. -
Returns an editable proxy of a specified
NSManagedObjectorCoreStoreObject.Declaration
Swift
public override func edit<D>(_ object: D?) -> D? where D : DynamicObjectParameters
objectthe
NSManagedObjectorCoreStoreObjectto be editedReturn Value
an editable proxy for the specified
NSManagedObjectorCoreStoreObject. -
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 : DynamicObjectParameters
intoan
Intoclause specifying the entity typeobjectIDthe
NSManagedObjectIDfor the object to be editedReturn Value
an editable proxy for the specified
NSManagedObjectorCoreStoreObject. -
Deletes a specified
NSManagedObjectorCoreStoreObject.Declaration
Swift
public override func delete<D>(_ object: D?) where D : DynamicObjectParameters
objectthe
NSManagedObjectorCoreStoreObjectto be deleted -
Deletes the specified
DynamicObjects.Declaration
Swift
public override func delete<D>(_ object1: D?, _ object2: D?, _ objects: D?...) where D : DynamicObjectParameters
object1the
DynamicObjectto be deletedobject2another
DynamicObjectto be deletedobjectsother
DynamicObjects to be deleted -
Deletes the specified
DynamicObjects.Declaration
Swift
public override func delete<S>(_ objects: S) where S : Sequence, S.Element : DynamicObjectParameters
objectsthe
DynamicObjects to be deleted
-
Declaration
Swift
public var bridgeToObjectiveC: CSAsynchronousDataTransaction { get }
-
Declaration
Swift
public var debugDescription: String { get }
View on GitHub
AsynchronousDataTransaction Class Reference