CharacterSetRule
public class CharacterSetRule: Rule
CharacterSetRule
is a subclass of Rule
. It is used to validate IPV4 address fields.
-
Initializes a
CharacterSetRule
object to verify that field has valid set of characters.Declaration
Swift
public init(characterSet: NSCharacterSet, message: String = "Enter valid alpha")
Parameters
characterSet
NSCharacterSet that holds group of valid characters.
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 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.