-
-
Save innocuo/8c8480a165d76b990abbcc279acc3356 to your computer and use it in GitHub Desktop.
Deliver an OSX notification with Swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func showNotification(title : String, informativeText: String) -> Void { | |
let notification = NSUserNotification() | |
notification.identifier = "\(NSDate().timeIntervalSince1970)" | |
notification.title = title | |
notification.informativeText = informativeText | |
notification.soundName = NSUserNotificationDefaultSoundName | |
NSUserNotificationCenter.default.deliver(notification) | |
} | |
//Example: showNotification("Some Title", "Description of notification.") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment