Swift Combine: Check if Subject has observer?
问题 In RxSwift we can check if a *Subject has any observer, using hasObserver, how can I do this in Combine on e.g. a PassthroughSubject ? 回答1: No one time needed this... Apple does not provide this by API, and, actually, I do not recommend such thing, because it is like manually checking value of retainCount in pre-ARC Objective-C for some decision in code. Anyway it is possible. Let's consider it as a lab exercise. Hope someone find this helpful. Disclaimer: below code was not tested with all