Would something like this work?
func sync_meets_async () {
...
let s = DispatchSemaphore (value: 0)
Task {
await async_world ()
s.signal()
}
...
print ("waiting for async_world to finish...")
s.wait()
print ("finished")
}
func async_world () async {
try! await Task.sleep(until: .now + .seconds(7))
}