Type Aliases

The following type aliases are available globally.

Example Hooks

  • An async throwing closure executed before an example is run.

    Declaration

    Swift

    public typealias BeforeExampleAsyncClosure = () async throws -> Void
  • A throwing closure executed before an example is run.

    Declaration

    Swift

    public typealias BeforeExampleClosure = @MainActor () throws -> Void
  • A closure executed before an example is run. This is only used by ObjC.

    Declaration

    Swift

    public typealias BeforeExampleNonThrowingClosure = @MainActor () -> Void
  • An async throwing closure executed before an example is run. The closure is given example metadata, which contains information about the example that is about to be run.

    Declaration

    Swift

    public typealias BeforeExampleWithMetadataAsyncClosure = (_ exampleMetadata: ExampleMetadata) async throws -> Void
  • A throwing closure executed before an example is run. The closure is given example metadata, which contains information about the example that is about to be run.

    Declaration

    Swift

    public typealias BeforeExampleWithMetadataClosure = @MainActor (_ exampleMetadata: ExampleMetadata) throws -> Void
  • A closure executed before an example is run. The closure is given example metadata, which contains information about the example that is about to be run. This is only used by ObjC

    Declaration

    Swift

    public typealias BeforeExampleWithMetadataNonThrowingClosure = @MainActor (_ exampleMetadata: ExampleMetadata) -> Void
  • A closure for running an example.

    Declaration

    Swift

    public typealias ExampleClosure = @MainActor () throws -> Void
  • An async throwing closure executed after an example is run.

    Declaration

    Swift

    public typealias AfterExampleAsyncClosure = BeforeExampleAsyncClosure
  • A throwing closure executed after an example is run.

    Declaration

    Swift

    public typealias AfterExampleClosure = BeforeExampleClosure
  • A closure executed after an example is run. This is only used by ObjC

    Declaration

    Swift

    public typealias AfterExampleNonThrowingClosure = BeforeExampleNonThrowingClosure
  • An async throwing closure executed after an example is run. The closure is given example metadata, which contains information about the example that has just finished running.

    Declaration

    Swift

    public typealias AfterExampleWithMetadataAsyncClosure = BeforeExampleWithMetadataAsyncClosure
  • A throwing closure executed after an example is run. The closure is given example metadata, which contains information about the example that has just finished running.

    Declaration

    Swift

    public typealias AfterExampleWithMetadataClosure = BeforeExampleWithMetadataClosure
  • A closure executed after an example is run. The closure is given example metadata, which contains information about the example that has just finished running.

    Declaration

    Swift

    public typealias AfterExampleWithMetadataNonThrowingClosure = BeforeExampleWithMetadataNonThrowingClosure
  • A throwing closure which wraps an example. The closure must call runExample() exactly once.

    Declaration

    Swift

    public typealias AroundExampleClosure = @MainActor (_ runExample: @escaping () -> Void) throws -> Void
  • A closure which wraps an example. The closure must call runExample() exactly once.

    Declaration

    Swift

    public typealias AroundExampleNonThrowingClosure = @MainActor (_ runExample: @escaping () -> Void) -> Void
  • A throwing closure which wraps an example. The closure is given example metadata, which contains information about the example that the wrapper will run. The closure must call runExample() exactly once.

    Declaration

    Swift

    public typealias AroundExampleWithMetadataClosure =
    @MainActor (_ exampleMetadata: ExampleMetadata, _ runExample: @escaping () -> Void) throws -> Void
  • A throwing closure which wraps an example. The closure is given example metadata, which contains information about the example that the wrapper will run. The closure must call runExample() exactly once.

    Declaration

    Swift

    public typealias AroundExampleWithMetadataNonThrowingClosure =
    @MainActor (_ exampleMetadata: ExampleMetadata, _ runExample: @escaping () -> Void) -> Void
  • An async throwing closure which wraps an example. The closure must call runExample() exactly once.

    Declaration

    Swift

    public typealias AroundExampleAsyncClosure = (_ runExample: @escaping () async -> Void) async throws -> Void
  • An async throwing closure which wraps an example. The closure is given example metadata, which contains information about the example that the wrapper will run. The closure must call runExample() exactly once.

    Declaration

    Swift

    public typealias AroundExampleWithMetadataAsyncClosure =
        (_ exampleMetadata: ExampleMetadata, _ runExample: @escaping () async -> Void) async throws -> Void

Suite Hooks

  • An async throwing closure executed before any examples are run.

    Declaration

    Swift

    public typealias BeforeSuiteAsyncClosure = () async throws -> Void
  • A throwing closure executed before any examples are run.

    Declaration

    Swift

    public typealias BeforeSuiteClosure = @MainActor () throws -> Void
  • A closure executed before any examples are run.

    Declaration

    Swift

    public typealias BeforeSuiteNonThrowingClosure = @MainActor () -> Void
  • An async throwing closure executed after all examples have finished running.

    Declaration

    Swift

    public typealias AfterSuiteAsyncClosure = BeforeSuiteAsyncClosure
  • A throwing closure executed after all examples have finished running.

    Declaration

    Swift

    public typealias AfterSuiteClosure = BeforeSuiteClosure
  • A closure executed after all examples have finished running.

    Declaration

    Swift

    public typealias AfterSuiteNonThrowingClosure = BeforeSuiteNonThrowingClosure
  • A closure that, when evaluated, returns a dictionary of key-value pairs that can be accessed from within a group of shared examples.

    Declaration

    Swift

    public typealias SharedExampleContext = () -> [String : Any]
  • A closure that is used to define a group of shared examples. This closure may contain any number of example and example groups.

    Declaration

    Swift

    public typealias SharedExampleClosure = (@escaping SharedExampleContext) -> Void