Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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