CancellableBag

@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *)
@available(*, deprecated, message: "Replace with mutable Set<AnyCancellable>")
public final class CancellableBag : Cancellable

A container for cancellables that will be cancelled when the bag is deallocated or cancelled itself

  • Adds a cancellable to the bag which will have its .cancel() method invoked when the bag is deallocated or cancelled itself

    Declaration

    Swift

    public func add<C>(_ cancellable: C) where C : Cancellable
  • Empties the bag and cancels each contained item

    Declaration

    Swift

    public func cancel()