TMDTask Class Reference

Conforms to ResultType
__covariant
Declared in TMDTask.h

Overview

The consumer view of a Task. A TMDTask has methods to inspect the state of the task, and to add continuations to be run once the task is complete.

TMDTask is based on Bolts Tasks, see https://github.com/BoltsFramework/Bolts-Swift for documentation.

+ taskWithResult:

Creates a task that is already completed with the given result.

+ (instancetype)taskWithResult:(nullable ResultType)result

Parameters

result

The result for the task.

Declared In

TMDTask.h

+ taskWithError:

Creates a task that is already completed with the given error.

+ (instancetype)taskWithError:(NSError *)error

Parameters

error

The error for the task.

Declared In

TMDTask.h

  result

The result of a successful task.

@property (nullable, nonatomic, strong, readonly) ResultType result

Declared In

TMDTask.h

  error

The error of a failed task.

@property (nullable, nonatomic, strong, readonly) NSError *error

Declared In

TMDTask.h

  faulted

Whether this task has completed due to an error.

@property (nonatomic, assign, readonly, getter=isFaulted) BOOL faulted

Declared In

TMDTask.h

  completed

Whether this task has completed.

@property (nonatomic, assign, readonly, getter=isCompleted) BOOL completed

Declared In

TMDTask.h

– continueWithBlock:

Enqueues the given block to be run once this task is complete. This method uses a default execution strategy. The block will be run on the thread where the previous task completes, unless the the stack depth is too deep, in which case it will be run on a dispatch queue with default priority.

- (TMDTask *)continueWithBlock:(TMDContinuationBlock)block

Parameters

block

The block to be run once this task is complete.

Return Value

A task that will be completed after block has run. If block returns a AWSTask, then the task returned from this method will not be completed until that task is completed.

Declared In

TMDTask.h

– continueWithSuccessBlock:

Identical to continueWithBlock:, except that the block is only run if this task did not produce a cancellation or an error. If it did, then the failure will be propagated to the returned task.

- (TMDTask *)continueWithSuccessBlock:(TMDContinuationBlock)block

Parameters

block

The block to be run once this task is complete.

Return Value

A task that will be completed after block has run. If block returns a AWSTask, then the task returned from this method will not be completed until that task is completed.

Declared In

TMDTask.h