Inherits from SPEventDispatcher : NSObject
Conforms to SPAnimatable
Declared in SPDelayedInvocation.h

Overview

An SPDelayedInvocation can be used to execute code at some time in the future.

It can work in two ways: first, as a proxy object that will forward any method invocations to a certain target. Second, it can simply execute an Objective-C block. Either way, the provided code is executed with a given delay.

The easiest way to delay an invocation is by calling [SPJuggler delayInvocationAtTarget:byTime:]. This method will create a delayed invocation for you, adding it to the juggler right away.

SPDelayedCall dispatches an Event of type SPEventTypeRemoveFromJuggler when it is finished, so that the juggler automatically removes it when it’s no longer needed.

Tasks

Initialization

Properties

  •   target

    The target object to which messages will be forwarded.

    property
  •   totalTime

    The time messages will be delayed (in seconds).

    property
  •   currentTime

    The time that has already passed (in seconds).

    property
  •   isComplete

    Indicates if the total time has passed and the invocations have been executed.

    property

Properties

currentTime

The time that has already passed (in seconds).

@property (nonatomic, assign) double currentTime

Discussion

The time that has already passed (in seconds).

Declared In

SPDelayedInvocation.h

isComplete

Indicates if the total time has passed and the invocations have been executed.

@property (nonatomic, readonly) BOOL isComplete

Discussion

Indicates if the total time has passed and the invocations have been executed.

Declared In

SPDelayedInvocation.h

target

The target object to which messages will be forwarded.

@property (nonatomic, readonly) id target

Discussion

The target object to which messages will be forwarded.

Declared In

SPDelayedInvocation.h

totalTime

The time messages will be delayed (in seconds).

@property (nonatomic, readonly) double totalTime

Discussion

The time messages will be delayed (in seconds).

Declared In

SPDelayedInvocation.h

Class Methods

invocationWithDelay:block:

Factory method.

+ (instancetype)invocationWithDelay:(double)time block:(SPCallbackBlock)block

Discussion

Factory method.

Declared In

SPDelayedInvocation.h

invocationWithTarget:delay:

Factory method.

+ (instancetype)invocationWithTarget:(id)target delay:(double)time

Discussion

Factory method.

Declared In

SPDelayedInvocation.h

Instance Methods

initWithDelay:block:

Initializes the delayed invocation of a block.

- (instancetype)initWithDelay:(double)time block:(SPCallbackBlock)block

Discussion

Initializes the delayed invocation of a block.

Declared In

SPDelayedInvocation.h

initWithTarget:delay:

Initializes a delayed invocation by acting as a proxy object forwarding method calls to the target after a certain time has passed.

- (instancetype)initWithTarget:(id)target delay:(double)time

Discussion

Initializes a delayed invocation by acting as a proxy object forwarding method calls to the target after a certain time has passed.

Declared In

SPDelayedInvocation.h

initWithTarget:delay:block:

Initializes a delayed invocation using both a target and a block. The instance will act as a proxy object, forwarding method calls to the target after a certain time has passed; the block will be invoked at the same time. Designated Initializer.

- (instancetype)initWithTarget:(id)target delay:(double)time block:(SPCallbackBlock)block

Discussion

Initializes a delayed invocation using both a target and a block. The instance will act as a proxy object, forwarding method calls to the target after a certain time has passed; the block will be invoked at the same time. Designated Initializer.

Declared In

SPDelayedInvocation.h