A publisher that performs type erasure by wrapping another publisher.
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
Any is a concrete implementation of
Publisher that has no significant properties of its own, and passes through elements and completion values from its upstream publisher.
Any to wrap a publisher whose type has details you don’t want to expose across API boundaries, such as different modules. Wrapping a
Any also prevents callers from accessing its
send(_:) method. When you use type erasure this way, you can change the underlying publisher implementation over time without affecting existing clients.
You can use Combine’s
erase operator to wrap a publisher with