How to use `UNNotificationPresentationOptions.list` in iOS 14

In iOS 14, UNNotificationPresentationOptions deprecated .alert , and replaced it with .banner and .list.

I understand .alert and .banner have the same action.
But, I don't know how to use .list .

There's no explanation in Apple's documentation.
https://developer.apple.com/documentation/usernotifications/unnotificationpresentationoptions/3564813-list

How do I use .list ?
Post not yet marked as solved Up vote post of uhooi Down vote post of uhooi
7.8k views

Replies

It is just another option of UNNotificationPresentationOptions. You can test it with some simple code using local notification.

Assuming you know how to request and respond local notification, try two versions of the UNUserNotificationCenterDelegate method and see what's the reference.
Code Block
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
print(#function)
completionHandler([.banner, .list, .sound])
}

And
Code Block
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {
print(#function)
completionHandler([.banner, .sound])
}


@OOPer
Thanks for reply.
I tried it and couldn't figure it out, so I asked the question.

I tried it and couldn't figure it out, so I asked the question.

Sorry, it was not clear what you had tried.

Have you tried showing the notification list, swiping down from the top edge of the screen, after the notification is sent?
@OOPer
I finally understand!
I see that .list sends notifications only to Notification Center.
I see that .banner sends notifications only to banner.

I finally understand!

That's what I found by experimenting the code.

Anyway, if Apple's documentations were better, we did not need experimenting or writing Q&A.
You may want to send a feedback to improve the documentations.