I have several notifications that were created using the block / trailing closure syntax that look like this:
NotificationCenter.default.addObserver(forName: .NSManagedObjectContextObjectsDidChange, object: moc, queue: nil) { note in
}
What I later deleted by name, for example:
NotificationCenter.default.removeObserver(self, name: NSNotification.Name.NSManagedObjectContextObjectsDidChange, object: moc)
My question
Is this adequate? Or do I absolutely need to save NSObjectProtocolits own property and delete this property with the following syntax?
NotificationCenter.default.removeObserver(didChangeNotification)
source
share