BlockPredicate
public class BlockPredicate<T> : Predicate
The BlockPredicate
class 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(aBlock: @escaping (InputType) -> Bool)
Parameters
aBlock
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, otherwisefalse
.