What bug ... the bug from this thread ...
Playgrounds can not run valid Swift code using XCode 13 Beta 5.
Can @eskimo open a bug for it?
Here just try this valid Swift 5.5 code in XCode 13 Beta 5 Playgrounds ...
func doIt() async -> String {
let t = TimeInterval.random(in: 0.25 ... 2.0)
Thread.sleep(forTimeInterval: t)
return String("\(Double.random(in: 0...1000))")
}
async {
async let a = doIt()
async let b = doIt()
async let c = doIt()
async let d = doIt()
let results = await [a, b, c, d]
for result in results {
print(" \(result)")
}
}
I have no idea how to fix the code format. I guess we can not format code in a comment? :-(