Field
public class Field : UIView
Wrapper class for all fields. Makes data model validation and UI feedback a breeze.
Attention
DateField subclasses this but does not override the text variable as it holds a Date value type-
The value in the text-based fields.
Declaration
Swift
public var text: String?
-
This is the placeholder, or
floating title
of the fieldDeclaration
Swift
public var placeholder: String?
-
Optional setter to append and
(Optional)
tag to the field’s placeholderNote
Defualts to falseDeclaration
Swift
public var isOptional: Bool
-
Read only flag to check if the field is currently active
Declaration
Swift
internal(set) public var isActive: Bool
-
Read only flag to check if the field is currently in a error state
Declaration
Swift
internal(set) public var hasError: Bool
-
Dictates if a field should shake if it has an error
Declaration
Swift
public var shakes: Bool
-
Defines the type of keyboard that comes up when the field is active
Note
Defaults to .asciiCapableDeclaration
Swift
public var keyboardType: UIKeyboardType
-
Defines the auto capitilazation type of the text entered
Note
Defaults to noneDeclaration
Swift
public var autocapitalizationType: UITextAutocapitalizationType
-
Defines the autocorrection used on the field
Note
Defaults to noneDeclaration
Swift
public var autocorrectionType: UITextAutocorrectionType
-
Defines if the field needs secure text entry (passwords)
Note
Defaults to falseDeclaration
Swift
public var isSecureTextEntry: Bool
-
A second tag element on the field
Declaration
Swift
public var tag2: Int
-
Border color
Note
Defaults to UIColor.lightGrayDeclaration
Swift
public var borderColor: UIColor
-
Border color when field is active
Note
Defaults to the material field’s baby blueDeclaration
Swift
public var borderHighlightColor: UIColor
-
Border color when there is an error in the field
Note
Defaults to UIColor.redDeclaration
Swift
public var borderErrorColor: UIColor
-
Normal text color
Note
Defaults to UIColor.blackDeclaration
Swift
public var textColor: UIColor
-
Error text color
Note
Defaults to UIColor.redDeclaration
Swift
public var errorTextColor: UIColor
-
Color of placeholder label when down
Note
Defaults to UIColor.grayDeclaration
Swift
public var placeholderDownColor: UIColor
-
Color of placeholder label when up
Note
Defaults to UIColor.blackDeclaration
Swift
public var placeholderUpColor: UIColor
-
Color of cursor in field
Note
Defaults to UIColor.black.withAlphaComponent(0.5)Declaration
Swift
public var cursorColor: UIColor
-
Error setter for text-based fields.
Note
- The error UI will dissapear automatically if the field becomes active again (EntryField, AreaField) or the values change (PickerField, DateField)
- If you overrode the shakes property to false, the field does not shake during the transition animation the error state
Declaration
Swift
public func setError(withText text: String?)
Parameters
withText
String for the error text label that will show up under the field
-
Clears error flag and UI from fields
- Called automatically if the field becomes active again (EntryField, AreaField) or the values change (PickerField, DateField)
Declaration
Swift
public func removeErrorUI()