Swift macOS Tutorial: Notifications (UNUserNotificationCenter, adding images and actions in Big Sur)

Опубликовано: 20 Октябрь 2024
на канале: Swift Goose
5,371
98

In this Swift macOS tutorial video we'll look at adding notifications to a macOS app on Big Sur (11.0, 11.2.3) using UNUserNotificationCenter, i.e. how to build out a notification request, adding an image to your notification, allowing the notification to appear while the app is in the foreground, and adding actions to your notifications.

00:00 Intro
00:31 New project
00:45 Copy image to project
01:04 Button setup
02:07 The old way to notify...
03:29 Request authorization
05:21 Notification ncprefs.plist file location
06:23 Get notification settings
06:54 Building out the notification request
11:04 Notify app when app is open (foreground)
13:11 Add image to notification
15:18 Add actions to notification
19:04 Setup actions to respond to clicks
23:13 End

GitHub repo: https://github.com/SwiftGoose5/swift_...
ncprefs info: https://mrmacintosh.com/how-to-manage...

Subscribe for more content, as I will be creating more tutorial and how-to videos for coding in Swift, as well as longer tutorials on building macOS apps.

If you'd like to support my work to help me improve video quality and bring more content, please consider donating to my PayPal:
https://www.paypal.com/paypalme/Swift...

Thank you for watching!

Huge thank you to the channels below for helping me get started!
Uncreated Light Press
   / @uncreatedlightpress4142  
and

Mr. Macintosh
   / @mr.macintosh  
and

The Apple Ninja
   / jessetheappleninja