Type Definitions

The following type definitions are available globally.

  • Block type for defining the action’s ‘perform’ code.

    @throws NSException when there is a failure and @c errorOrNil is not provided (i.e. it is @c nil).

    Declaration

    Objective-C

    typedef BOOL (^GREYPerformBlock)(id, NSError **)

    Parameters

    element

    The element on which the block is going to be performed. @param[out] errorOrNil The error set on failure. The error returned can be @c nil, signifying that the action succeeded.

    errorOrNil

    Return Value

    @c YES if the action performed succeeded, else @c NO.

  • A block that accepts an @c element, which will be invoked when an assertion is going to be performed on the element. If the assertion fails and a non-nil @c errorOrNil is provided, the block should populate it with the cause of failure.

    Declaration

    Objective-C

    typedef BOOL (^GREYCheckBlockWithError)(id, NSError **)

    Parameters

    element

    Element that the assertion will be checked against. @param[out] errorOrNil If non-nil, set to the cause of the assertion failure.

    errorOrNil

    Return Value

    @c YES if the assertion is valid for @c element, @c NO otherwise.

  • A block for implementing GREYBaseMatcher::matches:.

    Declaration

    Objective-C

    typedef BOOL (^MatchesBlock)(id)

    Parameters

    element

    The element passed to the block for matching.

    Return Value

    @c YES if the matcher’s specified condition was matched by the element, else @c NO.

  • A block for implementing GREYBaseMatcher::describeTo:.

    Declaration

    Objective-C

    typedef void (^DescribeToBlock)(id<GREYDescription>)

    Swift

    typealias DescribeToBlock = (Any?) -> Void

    Parameters

    description

    The description for the matcher.

  • Typedef for blocks that can be executed by the GREYUIThreadExecutor.

    Declaration

    Objective-C

    typedef void (^GREYExecBlock)(void)

    Swift

    typealias GREYExecBlock = () -> Void