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

Overview

A disposable that contains exactly one other disposable and allows it to be swapped out atomically.

Properties

disposable

The inner disposable managed by the serial disposable.

@property (atomic, strong) RACDisposable *disposable

Discussion

This property is thread-safe for reading and writing. However, if you want to read the current value and write a new one atomically, use swapInDisposable: instead.

Disposing of the receiver will also dispose of the current disposable set for this property, then set the property to nil. If any new disposable is set after the receiver is disposed, it will be disposed immediately and this property will remain set to nil.

Declared In

RACSerialDisposable.h

Class Methods

serialDisposableWithDisposable:

Creates a serial disposable which will wrap the given disposable.

+ (instancetype)serialDisposableWithDisposable:(RACDisposable *)disposable

Discussion

disposable - The value to set for disposable. This may be nil.

Returns a RACSerialDisposable, or nil if an error occurs.

Declared In

RACSerialDisposable.h

Instance Methods

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

swapInDisposable:

Atomically swaps the receiver’s disposable for newDisposable.

- (RACDisposable *)swapInDisposable:(RACDisposable *)newDisposable

Discussion

newDisposable - The new value for disposable. If the receiver has already been disposed, this disposable will be too, and disposable will remain set to nil. This argument may be nil.

Returns the previous value for the disposable property.

Declared In

RACSerialDisposable.h