Skip to content

Instantly share code, notes, and snippets.

@hG3n
Forked from ericdke/notification.swift
Created May 27, 2016 10:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hG3n/7293b1fc7543ecc2a943ac4ac0133496 to your computer and use it in GitHub Desktop.
Save hG3n/7293b1fc7543ecc2a943ac4ac0133496 to your computer and use it in GitHub Desktop.
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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment