Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aliakhtar49/4b4543a437869f5b6cd733c806043294 to your computer and use it in GitHub Desktop.
Save aliakhtar49/4b4543a437869f5b6cd733c806043294 to your computer and use it in GitHub Desktop.
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