I'm learning how to use swift to make mac app. I want my application to show local push notification to the user and here is my code.
func showNotification(title: String, informativeText: String) -> NSUserNotification {
let notification = NSUserNotification()
notification.title = title
notification.informativeText = informativeText
NSUserNotificationCenter.default.deliver(notification)
return notification
}
It will show a notification in the notification centre in my mac, but there is not a pop up notification at the top right corner of the screen. I've checked my System Preference and the Do Not Disturb mode has turned off already. Also, other apps in my mac can also show notification, only mine can't. I don't know what's wrong in my code