IntegerRule
public class IntegerRule : Rule
IntegerRule is a subclass of Rule that is used to make sure a the text of a field is an integer.
-
Initializes a
IntegerRuleobject to validate that the text of a field is only Integer.Declaration
Swift
public init(message : String = "This must be a number without a decimal")Parameters
messageString 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 field.
Declaration
Swift
public func validate(_ value: String) -> BoolParameters
valueString to checked for validation.
Return Value
Boolean value. True if validation is successful; False if validation fails.
-
Displays error message when field fails validation.
Declaration
Swift
public func errorMessage() -> StringReturn Value
String of error message.
IntegerRule Class Reference