RequiredPredicate
public struct RequiredPredicate<T> : Predicate where T : Collection
The RequiredPredicate
struct is used to evaluate whether a given input is empty.
let predicate = RequiredPredicate<String>()
let isValid = predicate.evaluate(with: "")
-
Declaration
Swift
public typealias InputType = T
-
Returns a new
RequiredPredicate
instance.let predicate = RequiredPredicate<String>() let isValid = predicate.evaluate(with: "")
Declaration
Swift
public init()
-
Returns a
Boolean
value that indicates whether a given input is empty.Declaration
Swift
public func evaluate(with input: T) -> Bool
Parameters
input
The input against which to evaluate the receiver.
Return Value
false
if input is empty, otherwisetrue
.