DisposeBag

public final class DisposeBag : DisposeBase

Thread safe bag that disposes added disposables on deinit.

This returns ARC (RAII) like resource management to RxSwift.

In case contained disposables need to be disposed, just put a different dispose bag or create a new one in its place.

self.existingDisposeBag = DisposeBag()

In case explicit disposal is necessary, there is also CompositeDisposable.

  • Constructs new empty dispose bag.

    Declaration

    Swift

    public override init()
  • Adds disposable to be disposed when dispose bag is being deinited.

    Declaration

    Swift

    public func insert(_ disposable: Disposable)

    Parameters

    disposable

    Disposable to add.

  • Convenience init allows a list of disposables to be gathered for disposal.

    Declaration

    Swift

    public convenience init(disposing disposables: Disposable...)
  • Convenience init allows an array of disposables to be gathered for disposal.

    Declaration

    Swift

    public convenience init(disposing disposables: [Disposable])
  • Convenience function allows a list of disposables to be gathered for disposal.

    Declaration

    Swift

    public func insert(_ disposables: Disposable...)
  • Convenience function allows an array of disposables to be gathered for disposal.

    Declaration

    Swift

    public func insert(_ disposables: [Disposable])