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 the Callback function.

    Unless the cancel() function is called prior to completion, the transaction will remain in memory until the Callback 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()
  • Called from within executeTransaction() when a transaction completes, just prior to the Callback being invoked.

    Declaration

    Swift

    func transactionCompleted(_ result: Result)

    Parameters

    result

    The instance of ResponseDataType that resulted from the transaction.