Contents

cancel()

Cancel the activity.

Declaration

func cancel()

Mentioned in

Discussion

When implementing Cancellable in support of a custom publisher, implement cancel() to request that your publisher stop calling its downstream subscribers. Combine doesn’t require that the publisher stop immediately, but the cancel() call should take effect quickly. Canceling should also eliminate any strong references it currently holds.

After you receive one call to cancel(), subsequent calls shouldn’t do anything. Additionally, your implementation must be thread-safe, and it shouldn’t block the caller.