Inspiration comes from NSObject-Rx
Cancellables no longer need to be defined, and can be used in any class like this anytime, anywhere.
subject
.sink { _ in }
.store(in: &combine.cancellables)
For the Swift native class, just adopted HasCancellable
to get it
class CancellableTest: HasCancellable {
init() {
[1].publisher
.sink { _ in }
.store(in: &combine.cancellables)
}
}