I am trying to perform a cleanup after the subscriber has stopped listening to the publisher.
My approach was to register for a closing and deallocation event, but I am struggling to figure out when a subscriber has stopped listening for events coming from a PassthroughSubject
.
By "subscriber has stopped listening", I mean that the subscriber (.sink
, for example), which created the subscription, either deallocated the subscription or explicitly called cancel
on the returned cancellable value.
I know other reactive libraries usually come with an onEnd
operator, but Combine doesn't have it. Is that even the right pattern here?