Functions

The following functions are available globally.

🖨 print overload functions

  • A public global function that formats and prints a message to the console corresponding to data stored as JSON for a given print number and behaves as an analogue overload of the Swift print(_:separator:terminator:) function.

    Declaration

    Swift

    @available(macOS 11.2, iOS 15.2, watchOS 8.3, tvOS 15.2, *)
    public func print(_ printNumber: Int,
                      functionName: String? = nil,
                      settings: SettingsManagerService? = nil)

    Parameters

    printNumber

    An Int that acts as a unique number used as a key to access a specific associated message from a dictionary containing all message data.

    functionName

    An optional parameter for a #function macro argument. If this parameter is included Clarity formats and prints the log as a function name node for the function that contains printNumber (see doc:Output-called-function-names).

    settings

    An optional parameter for a dynamic SettingsManagerService instance. The SettingsManagerService instance can have its properties set programmatically to a variety of values. This enables more convenient and dynamic evaluation of a wider range of unit tests in a test target than is possible when using the JSON access mechanism.

  • A public global function that formats and prints a message to the console corresponding to data stored as JSON for a given print number and behaves as an analogue overload of the Swift print(_:separator:terminator:) function.

    Declaration

    Swift

    @available(macOS 11.2, iOS 15.2, watchOS 8.3, tvOS 15.2, *)
    public func print(_ printNumber: Int,
                      values: Any? = nil,
                      settings: SettingsManagerService? = nil)

    Parameters

    printNumber

    An Int that acts as a unique number used as a key to access a specific associated message from a dictionary containing all message data.

    values

    An optional parameter for the inclusion of variable values to be printed as part of the message. If this parameter is included Clarity formats and prints the log as a value report node (see doc:Output-values-and-errors). The parameter can be a single value of any type, a Collection of any type or an instance conforming to the Error protocol.

    settings

    An optional parameter for a dynamic SettingsManagerService instance. The SettingsManagerService instance can have its properties set programmatically to a variety of values. This enables more convenient and dynamic evaluation of a wider range of unit tests in a test target than is possible when using the JSON access mechanism.