I am getting an error from the compiler:
Expression is 'async' but is not marked with 'await'
But the expression is not async.
Here's a minimalist example:
func testAsync() async -> String {
let result = App.instance.dataManager.getData() // ERROR: Expression is 'async' but is not marked with 'await'
...
async stuff here
...
return result
}
The error occurs on the first line of this function. But getData()
is not async, nor is dataManager
an async property.
I can get rid of the error if I get rid of the singleton instance property:
func testAsync() async -> String {
let dataManager = DataManager() // no error
let result = dataManager.getData() // no error
...
async stuff here
...
return result
}
But neither the singleton nor the instance property are async. If I comment out the "async stuff" and remove async
from the function declaration, it builds fine.
Is this a compiler error or am I missing something?