EnumRule

public class EnumRule<V> : ValidationRule<V> where V : Equatable

EnumRule is a subclass of ValidationRule that defines how a value is validated against mutiple possible values.

  • Undocumented

    Declaration

    Swift

    public init(values: [V], message: String = "does not match with any possible values.")
  • Method used to validate the provided value.

    Declaration

    Swift

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

    Parameters

    value

    Any value to checked for validation.

    Return Value

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