TestKitBase

open class TestKitBase : XCTestCase

A Base Class that provides some very basic functions for sleeping arbitrarily and waiting for a specific condition to occur (or timing out if that doesn’t happen)

  • Waits for the desired amount of time (and frees up the UI thread while it waits)

    Declaration

    Swift

    public func waitForDuration(_ timeout: TimeInterval)

    Parameters

    timeout

    The length of time to wait for

  • Waits for the provided condition block to evaluate to true, or the timeout amount of time to elapse.

    Declaration

    Swift

    @discardableResult
    public func waitForCondition(_ condition: () -> Bool, timeout: TimeInterval) -> Bool

    Parameters

    condition

    The block to evaluate for truthy/falsy.

    timeout

    The length of time to stop querying the block and just return false.

    Return Value

    True if the block evaluated truthy in the allotted time, false otherwise.