📜  swift 通知 mac - Swift 代码示例

📅  最后修改于: 2022-03-11 15:01:02.789000             🧑  作者: Mango

代码示例1
func showNotification() -> Void {
    var notification = NSUserNotification()
    notification.title = "Test from Swift"
    notification.informativeText = "The body of this Swift notification"
    notification.soundName = NSUserNotificationDefaultSoundName
    NSUserNotificationCenter.default.deliver(notification)
}

self.showNotification()