withMainSerialExecutor(operation:)

Perform an operation on the main serial executor.

MainSerialExecutor.swift:68
func withMainSerialExecutor(operation: () throws -> Void) rethrows

Parameters

operation

An operation to be performed on the main serial executor.

A synchronous version of withMainSerialExecutor(operation:) that can be used in XCTestCase.invokeTest to ensure all async tests are performed serially:

class BaseTestCase: XCTestCase {
  override func invokeTest() {
    withMainSerialExecutor {
      super.invokeTest()
    }
  }
}