Notification is a very elegant tool to notify user with new information and alert. There are two types of iOS notifications — Local notification and remote notification. Local notification is triggered by app independently due to a calendar event, a stopwatch or a location update. On the other hand, remote notification is triggered by server and delivered from APNs.

Local notification shares a lot of common properties with remote notification, except the trigger. There are some interesting parts and tricks on setting up and handling user interaction. In this article, it covers the following parts:

  1. Background information — Notification styles
  2. Basic code and Overall flowchart
  3. Declaration of UNNotificationAction & UNNotificationCategory
  4. Requesting notification authorization
  5. Setting of notification content
  6. Settings of NotificationTrigger
  7. Show notification at app foreground
  8. Handle user’s selection on UNNotificationAction
  9. Remove pending or delivered notification

Hope you can find this article useful on understanding the details of local notification. Let’s get started!

#notifications #swift-programming #ios #swift

Swift Local Notification All-In-One
1.85 GEEK