TTRequest

@interface TTRequest<Result> : NSOperation

The TTRequest class represents an abstract implementation of a Request that might be scheduled by TTRequstScheduler. This class is designed to be inherited by concrete Request implementations.

  • Creates a TTRequest object with a given completion block that is run once the Request is finished. The completion is run on the main thread.

    Declaration

    Objective-C

    - (instancetype)initWithCompletionHandler:
        (void (^)(TTResult<Result> *))completion;

    Swift

    init!(completionHandler completion: ((TTResult<Result>?) -> Void)!)

    Parameters

    completion

    A completion block that runs once a Request finishes. The block returns a result containing an encapsulated value in case of success or error. The completion block is run on the main thread.

  • Performs a synchronous Request.

    Declaration

    Objective-C

    - (TTResult<Result> *)perform;

    Swift

    func perform() -> TTResult<Result>!

    Return Value

    request The execution result encapsulating a generic value in case of success or error.