Last active
March 12, 2017 01:04
-
-
Save efremidze/349aa8d950b0d57ecac949fd66a4233f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class NotificationManager { | |
private var tokens = [String: AnyObject]() | |
deinit { | |
tokens.values.forEach { NC.removeObserver($0) } | |
} | |
func addObserver(forName name: NSNotification.Name, object obj: Any?, queue: OperationQueue?, using block: @escaping (Notification) -> Void) { | |
tokens[name.rawValue] = NC.addObserver(forName: name, object: obj, queue: queue, using: block) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment