DataTransaction
public protocol DataTransaction: class
An interface for an asynchronously-executing data transaction.
-
Causes the transaction to be executed. The transaction may be performed asynchronously. When complete, the
Result
is reported to theCallback
function.Unless the
cancel()
function is called prior to completion, the transaction will remain in memory until theCallback
is executed.Declaration
Swift
func executeTransaction(completion: @escaping Callback)
Parameters
completion
A function that will be called upon completion of the transaction.
-
The metadata type returned along with a successful transaction.
Declaration
Swift
associatedtype MetadataType
-
The result type passed to the transaction completion callback function.
Declaration
Swift
typealias Result = TransactionResult<ResponseDataType, MetadataType>
-
The signature of the callback function passed to
executeTransaction()
.Declaration
Swift
typealias Callback = (Result) -> Void
-
The data type returned by a successful transaction.
Declaration
Swift
associatedtype ResponseDataType
-
Attempts to cancel the transaction prior to completion.
Declaration
Swift
func cancel()