I have an app that has a reminder ‘mailbox’. The contents of the ‘mailbox’ is populated with notifications from UNUserNotificationCenter. When the app starts, I use UNUserNotificationCenter.getDeliveredNotifications in viewWillAppear to see if there are any new notifications that I need to add to the mailbox. If there are notifications to be added, I want to update the presence of, or icon associated with, the button used to open the ‘mailbox’. The problem is, UNUserNotification.getDeliveredNotifications handles results in a closure. By the time the closure runs, viewWillAppear has already completed. So, the question is how do I update a UI component from a closure? I tried .setNeedsDisplay on both the button and the view containing the button but that didn’t do it. I’ve Googled everything I can think of to no avail. Is what I’m trying to do even possible? Thanks.
Oh, one more thing, everything inside the UNUserNotification.getDeliveredNotifications is run in the main thread. I’m using Core Data to store my ‘mailbox’ data and it seems Core Data accesses need to run in the mail thread.