How do I perform a synchronous operation inside an async function without blocking the main thread?

You should use Task.detach so as not to inherit the main executor/actor. You can also use withContinuation to kick things off in the background manually.

1 Like