A type-erasing cancellable object that executes a provided closure when canceled.
SDKs
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
Framework
- Combine
Declaration
final class AnyCancellable
Overview
Subscriber implementations can use this type to provide a “cancellation token” that makes it possible for a caller to cancel a publisher, but not to use the Subscription
object to request items.
An Any
instance automatically calls cancel()
when deinitialized.