suggest change
  1. In xCode Navigator window go to Targets section. Press Add New Target.
  2. Select Notification Content Extension template:
  1. In your info.plist file set the identifier for UNNotificationExtensionCategory key:


UNNotificationExtensionCategory (Required)

The value of this key is a string or an array of strings. Each string contains the identifier of a category declared by the app using the UNNotification​Category class.

UNNotificationExtensionInitialContentSizeRatio (Required)

Number that represents the initial size of your view controller’s view expressed as a ratio of its height to its width.

UNNotificationExtensionDefaultContentHidden (Optional)

When set to YES, the system displays only your custom view controller in the notification interface. When set to NO, the system displays the default notification content in addition to your view controller’s content.

UNNotificationExtensionOverridesDefaultTitle (Optional)

The value of this key is a Boolean. When set to true, the system uses the title property of your view controller as the title of the notification. When set to false, the system sets the notification’s title to the name of your app. If you do not specify this key, the default value is set to false.

  1. Create custom view in NotificationViewController.swift file
  2. Add new category key and set its value to what we typed in the Info.plist (step 3):


 aps: {
 alert: { … },
 category: 'io.swifting.notification-category' 


let mutableNotificationContent = UNMutableNotificationContent()
mutableNotificationContent.category = "io.swifting.notification-category"
mutableNotificationContent.title = " Notifications"
mutableNotificationContent.subtitle = " presents"
mutableNotificationContent.body = "Custom notifications"

Also check out the official API reference:

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents