How can I wait for an async function from synchronous function in Swift 5.5?

You could maybe argue that asynchronous code doesn’t belong in setUp(), but it seems to me that to do so would be to conflate synchronicity with sequential…icity? The point of setUp() is to run before anything else begins running, but that doesn’t mean it has to be written synchronously, only that everything else needs to … Read more

Pattern for unit testing async queue that calls main queue on completion

There are two ways to get blocks dispatched to the main queue to run. The first is via dispatch_main, as mentioned by Drewsmits. However, as he also noted, there’s a big problem with using dispatch_main in your test: it never returns. It will just sit there waiting to run any blocks that come its way … Read more