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.
https://developer.apple.com/documentation/usernotifications/unusernotificationcenter
https://developer.apple.com/documentation/usernotifications/unusernotificationcenter/1649520-getdeliverednotifications
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 print(notifications) }