Inherits from RACDisposable : NSObject
Declared in RACSerialDisposable.h

Overview

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

Tasks

Properties

disposable

@property (atomic, strong) RACDisposable *disposable
Discussion

The inner disposable managed by the serial disposable.

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:

+ (instancetype)serialDisposableWithDisposable:(RACDisposable *)disposable
Discussion

Creates a serial disposable which will wrap the given disposable.

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

swapInDisposable:

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

Atomically swaps the receiver’s disposable for newDisposable.

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