I'm trying to understand the reason for this unexpected compiler error I'm getting. Here is how to reproduce the issue:
- Make two functions with the same name - one sync and one async
- I can call each one separately.
I'm using the 'task' SwiftUI modifier which takes an async closure:
- But if I use any
awaitin the task body, calling the sync version of the function produces compiler error. The compiler complains that I need to use 'await' with async functions. For example:
(The await call doesn't need to be to the same function, also a call to
Task.sleep(...) trigger the compiler error)
I don't see the reason why I can't call the sync version - is this a bug or a feature?