DateRule

public class DateRule : ValidationRule<String>

DateRule is a subclass of ValidationRule that means value can’t be nil or blank. Make sure required rule is the first item in rules list

  • Initializes a DateRule object that will validate a value is not nil.

    Declaration

    Swift

    public init(format: String, message: String = "is invalid.")

    Parameters

    message

    String of error message.

    Return Value

    An initialized DateRule object.

  • Method used to validate the provided value.

    Declaration

    Swift

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

    Parameters

    value

    Any value to be checked for validation.

    Return Value

    Error Message. nil if validation is successful; String if validation fails. Returns error for empty string or collection