Forked from christianselig/nested-swift-async-await.swift
Last active
April 29, 2022 13:12
-
-
Save rickclephas/10bf6e8d31f3cdc3b3d8cb65ebbff184 to your computer and use it in GitHub Desktop.
Using Swift concurrency async await within a checked continuation
This file contains 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 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