Avatar
func XCTAsync<Context>(_ context: Context, timeout: TimeInterval = 3.0, _ body: (inout Context, () -> Void) -> Void) { var context = context let expectation = XCTestExpectation() withExtendedLifetime(context) { body(&context, expectation.fulfill) wait(for: [expectation], timeout: timeout) } } (edited)
4:46 AM
こんな感じかな