CoordinateRule

public class CoordinateRule : ValidationRule<[Double]>

CoordinateRule is a subclass of ValidationRule that defines how check if a value is a latitude or longitude value. Value must be array of string or double. longitude should be first element.

  • Initializes a CoordinateRule object to validate that provided value is valid lat or long coordinate.

    Declaration

    Swift

    public override init(message: String = "is not a valid geo coordinate.")

    Parameters

    message

    String of error message.

    Return Value

    An initialized object.

  • Used to validate Coordinate value.

    Declaration

    Swift

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

    Parameters

    value

    Array of Double to be checked for validation. longitude should be first element.

    Return Value

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