ArrayRule

public class ArrayRule<V> : ValidationRule<Array<V>>

ArrayRule is a subclass of ValidationRule that defines how check if all array elements are valid.

  • Initializes a ArrayRule object to validate that provided array has valid elements.

    Declaration

    Swift

    public init(message: String = "contains invalid element.", rules: [ValidationRule<V>])

    Parameters

    message

    String of error message.

    Return Value

    An initialized object.

  • Used to validate value.

    Declaration

    Swift

    public override func validate(_ value: Array<V>?) -> String?

    Parameters

    value

    Array to be checked for validation.

    Return Value

    Error Message. nil if validation is successful; String if validation fails.