11 lines
217 B
Swift
11 lines
217 B
Swift
import Foundation
|
|
|
|
func wait(for block: @escaping @Sendable () async -> Void) {
|
|
let semaphore = DispatchSemaphore(value: 0)
|
|
Task {
|
|
await block()
|
|
semaphore.signal()
|
|
}
|
|
semaphore.wait()
|
|
}
|