在我看到的所有NotificationCenter示例中,都使用了默认的NotificationCenter.default。但是,我已经测试了子类NotificationCenter和使用自定义对象发布和侦听通知是可能的。import Foundation
let num: Int}
class TestObj: NotificationCenter,当自定义NotificationCenter被解除分配时会发生什么?
我有一个对象,我想发送到多个侦听器/订阅者,所以我签出合并,我看到了两种不同类型的出版商,即NotificationCenter.Publisher和PassThroughSubject。我不明白为什么有人会使用NotificationCenter.Publisher over PassThroughSubject。
不是那样的类型(因为我可以为同一个Notifica