We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ee72b44 commit 1363ec9Copy full SHA for 1363ec9
Foundation/NSNotification.swift
@@ -160,10 +160,9 @@ open class NotificationCenter: NSObject {
160
let receiverIdentifier: ObjectIdentifier = ObjectIdentifier(observer)
161
162
_observersLock.synchronized({
163
- if _observers[notificationNameIdentifier]?[senderIdentifier]?.count == 1 {
+ _observers[notificationNameIdentifier]?[senderIdentifier]?.removeValue(forKey: receiverIdentifier)
164
+ if _observers[notificationNameIdentifier]?[senderIdentifier]?.count == 0 {
165
_observers[notificationNameIdentifier]?.removeValue(forKey: senderIdentifier)
- } else {
166
- _observers[notificationNameIdentifier]?[senderIdentifier]?.removeValue(forKey: receiverIdentifier)
167
}
168
})
169
0 commit comments