CompositeDisposable

public final class CompositeDisposable : DisposeBase, Cancelable

Represents a group of disposable resources that are disposed together.

  • Key used to remove disposable from composite disposable

    Declaration

    Swift

    public struct DisposeKey
  • Declaration

    Swift

    public var isDisposed: Bool { get }
  • Undocumented

    Declaration

    Swift

    public override init()
  • Initializes a new instance of composite disposable with the specified number of disposables.

    Declaration

    Swift

    public init(_ disposable1: Disposable, _ disposable2: Disposable)
  • Initializes a new instance of composite disposable with the specified number of disposables.

    Declaration

    Swift

    public init(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable)
  • Initializes a new instance of composite disposable with the specified number of disposables.

    Declaration

    Swift

    public init(_ disposable1: Disposable, _ disposable2: Disposable, _ disposable3: Disposable, _ disposable4: Disposable, _ disposables: Disposable...)
  • Initializes a new instance of composite disposable with the specified number of disposables.

    Declaration

    Swift

    public init(disposables: [Disposable])
  • Adds a disposable to the CompositeDisposable or disposes the disposable if the CompositeDisposable is disposed.

    Declaration

    Swift

    public func insert(_ disposable: Disposable) -> DisposeKey?

    Parameters

    disposable

    Disposable to add.

    Return Value

    Key that can be used to remove disposable from composite disposable. In case dispose bag was already disposed nil will be returned.

  • Declaration

    Swift

    public var count: Int { get }

    Return Value

    Gets the number of disposables contained in the CompositeDisposable.

  • Removes and disposes the disposable identified by disposeKey from the CompositeDisposable.

    Declaration

    Swift

    public func remove(for disposeKey: DisposeKey)

    Parameters

    disposeKey

    Key used to identify disposable to be removed.

  • Disposes all disposables in the group and removes them from the group.

    Declaration

    Swift

    public func dispose()