Skip to content

Instantly share code, notes, and snippets.

@andreaslydemann
Last active October 30, 2018 18:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andreaslydemann/6fec4a01045b563d7038acb5f5afcac6 to your computer and use it in GitHub Desktop.
Save andreaslydemann/6fec4a01045b563d7038acb5f5afcac6 to your computer and use it in GitHub Desktop.
let center = NotificationCenter.default
center.addObserver(self,
selector: #selector(onNotificationReceived(_:)),
name: .notificationReceived,
object: nil)
@objc func onNotificationReceived(_ notification:Notification) {
if let data = notification.userInfo as? [String: Int] {
// Do something with the data
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment