BlockPredicate

public struct BlockPredicate<T> : Predicate

The BlockPredicate struct is used to define closure based conditions used to evaluate generic inputs.

  • Declaration

    Swift

    public typealias InputType = T
  • Creates and returns a new BlockPredicate instance.

    Declaration

    Swift

    public init(evaluationBlock: @escaping (InputType) -> Bool)

    Parameters

    evaluationBlock

    A closure describing a custom validation condition.

  • Returns a Boolean value that indicates whether a given input matches the evalutaion closure specified by the receiver.

    Declaration

    Swift

    public func evaluate(with input: InputType) -> Bool

    Parameters

    input

    The input against which to evaluate the receiver.

    Return Value

    true if input matches the validation closure specified by the receiver, otherwise false.