runSync(priority:_:)
Runs async closure and waits for its result in non-async code.
func runSync<T>(priority: TaskPriority? = nil, _ operation: () async -> T) -> T
Parameters
Returns
The value returned from the operation
.
Use with care as this blocks the current thread and violates “forward progress” Swift concurrency runtime contract.
See https://developer.apple.com/videos/play/wwdc2021/10254/?time=1582