@concurrent 特性

版本新特性 / Swift 6.2

// *** 在 6.2 版本中 ***
//该特性把工作从调用方的 actor 移到线程池上
@concurrent
func heavy(_ n: Int) async -> Int {
    (1...n).reduce(0, +)
}

let result = await heavy(1000)
print("result is \(result)")
//result is 500500