Issue #547
func sync<T>(_ work: (@escaping ([T]) -> Void) -> Void) -> [T] {
let semaphore = DispatchSemaphore(value: 1)
var results = [T]()
work { values in
results = values
semaphore.signal()
}
return results
}
sync({ completion in
service.load(completion)
})