How to check which notifications are active in status bar in iOS?

To get the list of notifications which are active on your status bar tray we are going to use getdeliverednotifications, you can read more about it here.

While it is know that we cannot get the notifications from all apps as that would be a privacy violation, but we can get the notification for our application

Apple provide getDeliveredNotifications(completionHandler:)

Which returns a list of the app’s notifications that are still displayed in Notification Center.

You can write the following code depending upon your need.

UNUserNotificationCenter.current().getDeliveredNotifications { (notifications) in