Validator
public protocol Validator
Validator
is a holder for conditions of type Condition
.
The validator checks for violation of each condition. Returned will be a collection of
violated conditions or nil
if the string to check is correct or no condition was added.
-
Initializer that creates a condition based on default values.
Declaration
Swift
init()
-
Conditions to use when validating text.
Declaration
Swift
var conditions: [Condition] { get set }
-
checkConditions(_:)
Default implementationChecks
text
for violation of each condition.Default Implementation
Declaration
Swift
func checkConditions(_ text: String?) -> [Condition]?
Parameters
text
String
to check.Return Value
An array of conditions that were violated by
text
. If no conditions were violated thennil
is returned. -
removeConditionOfClass(_:)
Default implementationRemoves all conditions of
conditionClass
type.Default Implementation
Declaration
Swift
mutating func removeConditionOfClass<T>(_ conditionClass: T.Type) where T : Condition
Parameters
conditionClass
Type
of condition to remove.