Adding actions to notifications

When you implemented the code to handle incoming notifications, you implemented a method called userNotificationCenter(_:didReceive:withCompletionHandler:). This method contains information about the way the user chose to handle the notification. The could have tapped on the notification itself, which is the default action, or maybe they chose one of the custom actions that are associated with the notification by swiping it. Another way for users to make custom notifications appear is to 3D-Touch on it.

There are three main kinds of actions supported by notifications. The first is a background action. Background actions dismiss the notification and wake the app in the background, so it can take appropriate ...

Get Mastering iOS 12 Programming - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.