Skip to content

Instantly share code, notes, and snippets.

@hvsw
Created June 3, 2018 20:04
Show Gist options
  • Save hvsw/f09510dcf1440509b58b5c82b5276da5 to your computer and use it in GitHub Desktop.
Save hvsw/f09510dcf1440509b58b5c82b5276da5 to your computer and use it in GitHub Desktop.
// TO BE CONTINUED...
extension Notification.Name {
func post(to notificationCenter: NotificationCenter = .default, withObject object: Any? = nil) {
notificationCenter.post(name: self, object: object)
}
}
extension Notification {
struct MyApp {
static let myAwesomeNotification = Notification.Name("myAwesomeNotification")
}
}
Notification.MyApp.myAwesomeNotification.post()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment