title: Xcode Async Unit Tests waiting on Main Thread
body: <p>I'm trying to test some asynchronous code using Unit Tests in Xcode, but I'm getting a blocked main thread.</p>
  
  <p>The problem is that some of the code being tested expects to receive a callback from an iOS class (AVFoundation). However, it seems the AVFoundation class will only callback on the Main thread.</p>
  
  <p>The problem is that if I'm doing an async unit test, then the test actually blocks the main thread while it's waiting, so the callback can never be sent. </p>
  
  <p>I'm pretty sure this is the problem. Is there any way to run the tests from another thread or have an <code>XCTWaiter</code> that doesn't block the main thread?</p>
  
  <p>Edit:
  After looking a bit at the docs, it seems like the best way to do this would be to run the entire test case on a background thread. However, in my current project the testing is all set up automatically. I wonder if anyone knows how to setup a test case / run manually. That way I could run it on another thread.</p>