Skip to content

Instantly share code, notes, and snippets.

@brettshumaker
Forked from ericdke/notification.swift
Created May 21, 2019 19:04
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 brettshumaker/53731460516d86dcec7de8c4034c03f6 to your computer and use it in GitHub Desktop.
Save brettshumaker/53731460516d86dcec7de8c4034c03f6 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