Functions
The following functions are available globally.
-
Converts a primitive value to its
String
representation.Declaration
Swift
public func primitive(_ value: Any?) -> String?
Parameters
value
A primitive value.
Return Value
A
String
representation of the value ornil
if it can’t be convert toString
. -
Converts a primitive value to its
String
representation or throws aValidator.Error
.Declaration
Swift
@discardableResult public func assertPrimitive(_ value: Any?) throws -> String
Parameters
value
A primitive value.
Return Value
A
String
representation of the value. -
Converts a
Constraint
to a certain concrete type or throws aValidator.Error
.Throws
AValidator.Error
if the constraint can’t be converted to the certain type.Declaration
Swift
@discardableResult public func assertConstraintType<T>(_ type: T.Type, for constraint: Constraint) throws -> T where T : Constraint
Parameters
type
A concrete type of
Constraint
to convert to.constraint
A
Constraint
to be converted.Return Value
A converted concrete type of
Constraint
.