How to clean up UNNotificationAttachments?

I use a UNNotificationServiceExtension to download an image into temporaryDirectory that is attached as an UNNotificationAttachment to the notification.

FileManager.default.temporaryDirectory
  .appendingPathComponent(UUID().
  .appendingPathExtension(image.ext)
data.write(to: fileUrl)
let attachment = ...
attachments.append(attachment)

The documentation for UNNotificationAttachment say I am responsible to manage the storage space for such attachments:

The system limits the amount of storage space allocated for attachments for each app. To delete attachments, use the methods of the UNUserNotificationCenter class to remove the notification requests that contain those attachments.

https://developer.apple.com/documentation/usernotifications/unnotificationattachment

Do I need to check in my AppDelegate if there are any notifications that are no longer displayed and remove their files?

If so, how how to get a list of notifications that are no longer displayed?

How to clean up UNNotificationAttachments?
 
 
Q