Inherits from RACDisposable : NSObject
Declared in RACCompoundDisposable.h
RACCompoundDisposable.m

Overview

A disposable of disposables. When it is disposed, it disposes of all its contained disposables.

If addDisposable: is called after the compound disposable has been disposed of, the given disposable is immediately disposed. This allows a compound disposable to act as a stand-in for a disposable that will be delivered asynchronously.

Class Methods

compoundDisposable

Creates and returns a new compound disposable.

+ (instancetype)compoundDisposable

Declared In

RACCompoundDisposable.h

compoundDisposableWithDisposables:

Creates and returns a new compound disposable containing the given disposables.

+ (instancetype)compoundDisposableWithDisposables:(NSArray *)disposables

Declared In

RACCompoundDisposable.h

Instance Methods

addDisposable:

Adds the given disposable. If the receiving disposable has already been disposed of, the given disposable is disposed immediately.

- (void)addDisposable:(RACDisposable *)disposable

Discussion

This method is thread-safe.

disposable - The disposable to add. This may be nil, in which case nothing happens.

Declared In

RACCompoundDisposable.h

dispose

Performs the disposal work. Can be called multiple times, though sebsequent calls won’t do anything.

- (void)dispose

Declared In

RACDisposable.h

isDisposed

Whether the receiver has been disposed.

- (BOOL)isDisposed

Discussion

Use of this property is discouraged, since it may be set to YES concurrently at any time.

This property is not KVO-compliant.

Declared In

RACDisposable.h

removeDisposable:

Removes the specified disposable from the compound disposable (regardless of its disposed status), or does nothing if it’s not in the compound disposable.

- (void)removeDisposable:(RACDisposable *)disposable

Discussion

This is mainly useful for limiting the memory usage of the compound disposable for long-running operations.

This method is thread-safe.

disposable - The disposable to remove. This argument may be nil (to make the use of weak references easier).

Declared In

RACCompoundDisposable.h