This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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 |
NewerOlder