I have multiple controllers:
Home VCMyNotifVC
In myNotifVC I have a list of all the pending notification.
I am trying to update the number of notification in HomeVC as the notifications are delivered.
So basically I would like to update a var (var deliveredNotif: Int) in HomeVC as soon as a notification is delivered (independently from which controller is active).
So far in myNotifVC i have:
func getDeliveredNotif(){
UNUserNotificationCenter.current().getDeliveredNotifications(completionHandler: {deliveredNotifications -> () in
if let notifVC = self.presentingViewController as? HomeVC {
notifVC.delivered = deliveredNotifications.count
}
})
}
How can I store in my var delivered (which is declared in my HomeVC) the number of delivered notification either if HomeVC is running or as soon as it will be running?
Thank you!
Do this-