TypedSerialDisposable
public final class TypedSerialDisposable<Inner> : Disposable where Inner : Disposable
A disposable that disposes of its wrapped disposable, and allows its
wrapped disposable to be replaced.
The Inner
disposable type is fixed and cannot be changed.
Note
This class is backed internally by aSerialDisposable()
, so if the documentation
of this class differs in any way from SerialDisposable
, please use its documentation
as the source of truth.
-
Declaration
Swift
public var isDisposed: Bool { get }
-
The current inner disposable to dispose of.
Whenever this property is set (even to the same value!), the previous disposable is automatically disposed.
Declaration
Swift
public var inner: Inner? { get set }
-
Initializes the receiver to dispose of the argument when the TypedSerialDisposable is disposed.
Declaration
Swift
public init(_ disposable: Inner? = nil)
Parameters
disposable
Optional disposable.
-
Declaration
Swift
public func dispose()
-
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: TypedSerialDisposable<CompositeDisposable>, rhs: Disposable?) -> Disposable?
Parameters
lhs
Disposable to add to.
rhs
Disposable to add.
Return Value
A
Disposable
that can be used to opaquely remove the disposable later (if desired). -
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: TypedSerialDisposable<CompositeDisposable>, rhs: @escaping () -> Void) -> Disposable?
Parameters
lhs
Disposable to add to.
rhs
Disposable to add.
Return Value
A
Disposable
that can be used to opaquely remove the disposable later (if desired).