Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save rickclephas/10bf6e8d31f3cdc3b3d8cb65ebbff184 to your computer and use it in GitHub Desktop.
Save rickclephas/10bf6e8d31f3cdc3b3d8cb65ebbff184 to your computer and use it in GitHub Desktop.
Using Swift concurrency async await within a checked continuation
func doACoolAsyncThing() async -> Bool {
let result = await withCheckedContinuation { continuation in
SomeAPI.oldSchoolContinuationHandler { result in
continuation.returning(result)
}
}
guard result else { return false }
return await isThe50000thDigitOfPi9()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment