dinneo
10/13/2017 - 3:52 PM

Deliver an OSX notification with Swift

Deliver an OSX notification with Swift

func showNotification() -> Void {
    var notification = NSUserNotification()
    notification.title = "Test from Swift"
    notification.informativeText = "The body of this Swift notification"
    notification.soundName = NSUserNotificationDefaultSoundName
    NSUserNotificationCenter.defaultUserNotificationCenter().deliverNotification(notification)
}

//showNotification()