In an Xcode 13 beta 1 playground, with the scheme set to a Swift package that sets the correct flags, I'm able to compile some structs with async functions and await statements. However I haven't been able to figure out how to actually call those functions from within the playground. The following code generates the error, "cannot find 'async' in scope" for the usage in Doer.go():
import Foundation
struct X {
func x() async -> Bool {
await Y().y { print("y") }
print("x")
return true
}
}
struct Y {
func y(_ work: @escaping () -> Void) async { work() }
}
struct Doer {
func go() {
async {
let result = await X().x()
print(result)
}
}
}
Doer().go()
Any tips would be appreciated... thanks!