FloatRule

public class FloatRule:Rule

FloatRule is a subclass of Rule that defines how check if a value is a floating point value.

  • Initializes a FloatRule object to validate that the text of a text field is a floating point number.

    Declaration

    Swift

    public init(message : String = "This must be a number with or without a decimal")

    Parameters

    message

    String of error message.

    Return Value

    An initialized object, or nil if an object could not be created for some reason that would not result in an exception.

  • Used to validate text field.

    Declaration

    Swift

    public func validate(value: String) -> Bool

    Parameters

    value

    String to checked for validation.

    Return Value

    Boolean value. True if validation is successful; False if validation fails.

  • Displays error message when text field fails validation.

    Declaration

    Swift

    public func errorMessage() -> String

    Return Value

    String of error message.