Example (Apple Official)
let cancellable = (0...2).publisher
.handleEvents(receiveSubscription: { subs in
print("Subscription: \(subs.combineIdentifier)")
}, receiveOutput: { anInt in
print("in output handler, received \(anInt)")
}, receiveCompletion: { _ in
print("in completion handler")
}, receiveCancel: {
print("received cancel")
}, receiveRequest: { (demand) in
print("received demand: \(demand.description)")
})
.sink { _ in return }