I am currently making a XIB Menu Bar application that displays a notification using this code:
func showNotification(message:String, title:String = "App Name") -> Void {
let notification = NSUserNotification()
notification.title = title
notification.informativeText = message
NSUserNotificationCenter.defaultUserNotificationCenter().deliverNotification(notification)
}
And calling it like this:
showNotification("\(song)\n\(artist)",title: "Now Playing")
The notification works when the Menu Bar application is hidden away (not shown), however when the user has it shown, the notification does not show.
Is there a way to show the notification while the application is in view?