CompositeDisposable
public final class CompositeDisposable : Disposable
A disposable that will dispose of any number of other disposables.
-
Declaration
Swift
public var isDisposed: Bool { get } -
Initialize a
CompositeDisposablecontaining the given sequence of disposables.Declaration
Swift
public init<S>(_ disposables: S) where S : Sequence, S.Element == DisposableParameters
disposablesA collection of objects conforming to the
Disposableprotocol -
Initialize a
CompositeDisposablecontaining the given sequence of disposables.Declaration
Swift
public convenience init<S: Sequence>(_ disposables: S) where S.Iterator.Element == Disposable?Parameters
disposablesA collection of objects conforming to the
Disposableprotocol -
Initializes an empty
CompositeDisposable.Declaration
Swift
public convenience init() -
Declaration
Swift
public func dispose() -
Add the given disposable to the composite.
Declaration
Swift
@discardableResult public func add(_ disposable: Disposable?) -> Disposable?Parameters
disposableA disposable.
Return Value
A disposable to remove
disposablefrom the composite.nilif the composite has been disposed of,disposablehas been disposed of, ordisposableisnil. -
Add the given action to the composite.
Declaration
Swift
@discardableResult public func add(_ action: @escaping () -> Void) -> Disposable?Parameters
actionA closure to be invoked when the composite is disposed of.
Return Value
A disposable to remove
disposablefrom the composite.nilif the composite has been disposed of,disposablehas been disposed of, ordisposableisnil. -
Adds the right-hand-side disposable to the left-hand-side
CompositeDisposable.disposable += producer .filter { ... } .map { ... } .start(observer)Declaration
Swift
@discardableResult public static func += (lhs: CompositeDisposable, rhs: Disposable?) -> Disposable?Parameters
lhsDisposable to add to.
rhsDisposable to add.
Return Value
An instance of
DisposableHandlethat can be used to opaquely remove the disposable later (if desired). -
Adds the right-hand-side
ActionDisposableto the left-hand-sideCompositeDisposable.disposable += { ... }Declaration
Swift
@discardableResult public static func += (lhs: CompositeDisposable, rhs: @escaping () -> Void) -> Disposable?Parameters
lhsDisposable to add to.
rhsClosure to add as a disposable.
Return Value
An instance of
DisposableHandlethat can be used to opaquely remove the disposable later (if desired).
View on GitHub
Install in Dash
CompositeDisposable Class Reference