I am trying to understand as to why following piece of code throws an assertion. What I am trying to do is to call asyncFunc() on main thread/main actor from call site. I don't want to decorate asyncFunc with @MainActor as I want the function to be thread agnostic.
func asyncFunc() async -> String? {
dispatchPrecondition(condition: .onQueue(.main))
return "abc"
}
func callSite() {
Task { @MainActor in
await asyncFunc()
}
}
My understanding was that Task { @MainActor ...} would execute all the following code on MainActor/main thread.
Post
Replies
Boosts
Views
Activity
iOS 14 introduced new extension to change password to a strong one from Settings. I was looking into exploring it but am unable to debug it. Does anyone know of a way to do so?