Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jacobsapps/e50b8126a9a4fa7e649a670a69544719 to your computer and use it in GitHub Desktop.
Save jacobsapps/e50b8126a9a4fa7e649a670a69544719 to your computer and use it in GitHub Desktop.
var task: Task<Void, Error>?
task = Task {
async let name = fetchUserName()
async let avatar = fetchUserAvatar()
// this will throw if either child task checks cancellation
try await (name, avatar)
}
task?.cancel()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment