Last active
December 27, 2016 15:13
-
-
Save wagnercasey/78ce3d729d035e3e7b851e6fe6f70910 to your computer and use it in GitHub Desktop.
Notification Center Sugar
This file contains hidden or 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
| enum NotificationCenterKey : String { | |
| case screaming, yelling, hollering | |
| } | |
| extension NotificationCenter { | |
| static func post(notification : NotificationCenterKey){ | |
| NotificationCenter.default.post(name: Notification.Name(rawValue: notification.rawValue), object: nil) | |
| } | |
| static func setObserver(observer : Any, selector : Selector, notification : NotificationCenterKey){ | |
| NotificationCenter.default.addObserver(observer, selector: selector, name: Notification.Name(rawValue: notification.rawValue), object: nil) | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment