Created
May 10, 2022 19:36
-
-
Save aliakhtar49/4b4543a437869f5b6cd733c806043294 to your computer and use it in GitHub Desktop.
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
func downloadImageAndMetadata(imageNumber: Int) async throws -> DetailedImage { | |
return try await withCheckedThrowingContinuation({ | |
(continuation: CheckedContinuation<DetailedImage, Error>) in | |
downloadImageAndMetadata(imageNumber: imageNumber) { image, error in | |
if let image = image { | |
continuation.resume(returning: image) | |
} else { | |
continuation.resume(throwing: error!) | |
} | |
} | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment