Post

Replies

Boosts

Views

Activity

XCode 13 - Task not found in scope?
Hello, I'm trying to perform simple async tasks wrapped in a Task struct but the compiler always says "error: cannot find 'Task' in scope" using XCode 13 with macOS 12's last beta Even the simplier playground like this one, fails: import Foundation func foo() async -> String {     await withUnsafeContinuation { continuation in         DispatchQueue.main.asyncAfter(deadline: .now() + 1) {             continuation.resume(returning: "Hello")         }     } } func bar() {     Task {         let text = await foo()         print(text)     } } Results in: error: MyPlayground.playground:13:5: error: cannot find 'Task' in scope     Task {     ^~~~ So... is this normal or am I missing something basic (and stupid)? Thanks
6
0
3.9k
Oct ’21