Inherits from RACSignal : RACStream : NSObject
Conforms to RACSubscriber
Declared in RACChannel.h
RACChannel.m

Overview

Represents one end of a RACChannel.

An terminal is similar to a socket or pipe – it represents one end of a connection (the RACChannel, in this case). Values sent to this terminal will not be received by its subscribers. Instead, the values will be sent to the subscribers of the RACChannel’s other terminal.

For example, when using the followingTerminal, sent values can only be received from the leadingTerminal, and vice versa.

To make it easy to terminate a RACChannel, error and completed events sent to either terminal will be received by the subscribers of both terminals.

Do not instantiate this class directly. Create a RACChannel instead.

Instance Methods

didSubscribeWithDisposable:

Sends the subscriber a disposable that represents one of its subscriptions.

- (void)didSubscribeWithDisposable:(RACDisposable *)disposable

Discussion

A subscriber may receive multiple disposables if it gets subscribed to multiple signals; however, any error or completed events must terminate all subscriptions.

Declared In

RACSubscriber.h

sendCompleted

Send completed to subscribers.

- (void)sendCompleted

Discussion

This terminates the subscription, and invalidates the subscriber (such that it cannot subscribe to anything else in the future).

Declared In

RACSubscriber.h

sendError:

Send the error to subscribers.

- (void)sendError:(NSError *)error

Discussion

error - The error to send. This can be nil.

This terminates the subscription, and invalidates the subscriber (such that it cannot subscribe to anything else in the future).

Declared In

RACSubscriber.h

sendNext:

Send the next value to subscribers.

- (void)sendNext:(id)value

Discussion

value - The value to send. This can be nil.

Declared In

RACSubscriber.h

subscribe:

Subscribes subscriber to changes on the receiver. The receiver defines which events it actually sends and in what situations the events are sent.

- (RACDisposable *)subscribe:(id<RACSubscriber>)subscriber

Discussion

Subscription will always happen on a valid RACScheduler. If the [RACScheduler currentScheduler] cannot be determined at the time of subscription (e.g., because the calling code is running on a GCD queue or NSOperationQueue), subscription will occur on a private background scheduler. On the main thread, subscriptions will always occur immediately, with a [RACScheduler currentScheduler] of [RACScheduler mainThreadScheduler].

This method must be overridden by any subclasses.

Returns nil or a disposable. You can call [RACDisposable dispose] if you need to end your subscription before it would “naturally” end, either by completing or erroring. Once the disposable has been disposed, the subscriber won’t receive any more events from the subscription.

Declared In

RACSignal.h