Removing Observers

suggest change

Swift 3

//Remove observer for single notification
NotificationCenter.default.removeObserver(self, name: NSNotification.Name(rawValue: "TestNotification"), object: nil)

//Remove observer for all notifications
NotificationCenter.default.removeObserver(self)

Objective-C

//Remove observer for single notification
[[NSNotificationCenter defaultCenter] removeObserver:self name:@"TestNotification" object:nil];
    
//Remove observer for all notifications
[[NSNotificationCenter defaultCenter] removeObserver:self];

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents