Inherits from NSObject
Declared in RACCommand.h

Overview

A command is a signal triggered in response to some action, typically UI-related.

Tasks

Other Methods

  •   executionSignals

    Errors will be automatically caught upon the inner signals, and sent upon errors instead. If you want to receive inner errors, use -execute: or [RACSignal materialize].

    property
  •   executing

    This signal will send its current value upon subscription, and then all future values on the main thread.

    property
  •   enabled

    This signal will send its current value upon subscription, and then all future values on the main thread.

    property
  •   errors

    After subscription, this signal will send all future errors on the main thread.

    property
  •   allowsConcurrentExecution

    The default value for this property is NO.

    property
  • – initWithSignalBlock:

    Invokes initWithEnabled:signalBlock: with a nil enabledSignal.

  • – initWithEnabled:signalBlock:

    enabledSignal - A signal of BOOLs which indicate whether the command should be enabled. enabled will be based on the latest value sent from this signal. Before any values are sent, enabled will default to YES. This argument may be nil. signalBlock - A block which will map each input value (passed to execute:) to a signal of work. The returned signal will be multicasted to a replay subject, sent on executionSignals, then subscribed to synchronously. Neither the block nor the returned signal may be nil.

  • – execute:

    Returns the multicasted signal, after subscription. If the receiver is not enabled, returns a signal that will send an error with code RACCommandErrorNotEnabled.

Unavailable Methods

Properties

allowsConcurrentExecution

@property (atomic, assign) BOOL allowsConcurrentExecution
Discussion

The default value for this property is NO.

Declared In

RACCommand.h

canExecute

@property (atomic, readonly) BOOL canExecute

enabled

@property (nonatomic, strong, readonly) RACSignal *enabled
Discussion

This signal will send its current value upon subscription, and then all future values on the main thread.

Declared In

RACCommand.h

errors

@property (nonatomic, strong, readonly) RACSignal *errors
Discussion

After subscription, this signal will send all future errors on the main thread.

Declared In

RACCommand.h

executing

@property (nonatomic, strong, readonly) RACSignal *executing
Discussion

This signal will send its current value upon subscription, and then all future values on the main thread.

Declared In

RACCommand.h

executionSignals

@property (nonatomic, strong, readonly) RACSignal *executionSignals
Discussion

Errors will be automatically caught upon the inner signals, and sent upon errors instead. If you want to receive inner errors, use -execute: or [RACSignal materialize].

Only executions that begin after subscription will be sent upon this signal. All inner signals will arrive upon the main thread.

Declared In

RACCommand.h

Class Methods

command

+ (instancetype)command

commandWithCanExecuteSignal:

+ (instancetype)commandWithCanExecuteSignal:(RACSignal *)canExecuteSignal

Instance Methods

addSignalBlock:

- (RACSignal *)addSignalBlock:(RACSignal *( ^ ) ( id value ))signalBlock

execute:

- (RACSignal *)execute:(id)input
Discussion

Returns the multicasted signal, after subscription. If the receiver is not enabled, returns a signal that will send an error with code RACCommandErrorNotEnabled.

Declared In

RACCommand.h

initWithCanExecuteSignal:

- (id)initWithCanExecuteSignal:(RACSignal *)canExecuteSignal

initWithEnabled:signalBlock:

- (id)initWithEnabled:(RACSignal *)enabledSignal signalBlock:(RACSignal *( ^ ) ( id input ))signalBlock
Discussion

enabledSignal - A signal of BOOLs which indicate whether the command should be enabled. enabled will be based on the latest value sent from this signal. Before any values are sent, enabled will default to YES. This argument may be nil. signalBlock - A block which will map each input value (passed to execute:) to a signal of work. The returned signal will be multicasted to a replay subject, sent on executionSignals, then subscribed to synchronously. Neither the block nor the returned signal may be nil.

Declared In

RACCommand.h

initWithSignalBlock:

- (id)initWithSignalBlock:(RACSignal *( ^ ) ( id input ))signalBlock
Discussion

Invokes initWithEnabled:signalBlock: with a nil enabledSignal.

Declared In

RACCommand.h