/WrappingCompletionHandler.swift Secret
Created
March 19, 2023 11:55
Star
You must be signed in to star a gist
This file contains 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
final class ImageFetcher { | |
func fetchImages(for identifiers: [String], completionHandler: @escaping (Result<[String: UIImage], Error>) -> Void) { | |
// … | |
} | |
} | |
extension ImageFetcher { | |
func fetchImages(for identifiers: [String]) async throws -> [String: UIImage] { | |
try await withCheckedThrowingContinuation { continuation in | |
fetchImages(for: identifiers) { result in | |
continuation.resume(with: result) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment