Check out example codes for "swift notifications mac". It will help you in understanding the concepts better.
Code Example 1
func showNotification() -> Void {
var notification = NSUserNotification()
notification.title = "Test from Swift"
notification.informativeText = "The body of this Swift notification"
notification.soundName = NSUserNotificationDefaultSoundName
NSUserNotificationCenter.default.deliver(notification)
}
self.showNotification()
Learn ReactJs, React Native from akashmittal.com