To generate a MacOS notification in Swift, you can use either the NSUserNotificationCenter
or UserNotifications
framework depending on the version of MacOS you are targeting.
main.swift263 chars11 lines
main.swift629 chars18 lines
Both methods allow you to customize the title, message, and sound of the notification as well as set a trigger for when the notification should be shown.
gistlibby LogSnag