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
Post
Replies
Boosts
Views
Activity
I mean: if I would like to create a property wrapper similar to @FetchRequest but using a different underlaying data source, will it be possible?
Or in a more concrete way: how can I send a state change from my own property wrapper so the view hierarchy is updated as response?