Skip to content

Instantly share code, notes, and snippets.

@willie-hung
Created September 26, 2023 16:50
Show Gist options
  • Save willie-hung/b9eea4560b331521d250b21162b07308 to your computer and use it in GitHub Desktop.
Save willie-hung/b9eea4560b331521d250b21162b07308 to your computer and use it in GitHub Desktop.
 iOS Interview Prep 7- Async/Await
do {
// 1. Call the method
let images = try await fetchImages()
// 2. Fetch images method returns
// 3. Call the resize method
let resizedImages = try await resizeImages(images)
// 4. Resize method returns
print("Fetched \(images.count) images.")
} catch {
print("Fetching images failed with error \(error)")
}
// 5. The calling method exits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment