Skip to content

Instantly share code, notes, and snippets.

// MARK: - Helper Functions
extension NotificationService {
/// Use this function to download an image and present it in a notification
///
/// - Parameters:
/// - url: the url of the picture
/// - completion: return the image in the form of UNNotificationAttachment to be added to the bestAttemptContent attachments eventually
private func downloadImageFrom(url: URL, with completionHandler: @escaping (UNNotificationAttachment?) -> Void) {
let task = URLSession.shared.downloadTask(with: url) { (downloadedUrl, response, error) in