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 field

    Declaration

    Swift

    public var placeholder: String?
  • Optional setter to append and (Optional) tag to the field’s placeholder

    Note

    Defualts to false

    Declaration

    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 .asciiCapable

    Declaration

    Swift

    public var keyboardType: UIKeyboardType
  • Defines the auto capitilazation type of the text entered

    Note

    Defaults to none

    Declaration

    Swift

    public var autocapitalizationType: UITextAutocapitalizationType
  • Defines the autocorrection used on the field

    Note

    Defaults to none

    Declaration

    Swift

    public var autocorrectionType: UITextAutocorrectionType
  • Defines if the field needs secure text entry (passwords)

    Note

    Defaults to false

    Declaration

    Swift

    public var isSecureTextEntry: Bool
  • A second tag element on the field

    Declaration

    Swift

    public var tag2: Int
  • Border color

    Note

    Defaults to UIColor.lightGray

    Declaration

    Swift

    public var borderColor: UIColor
  • Border color when field is active

    Note

    Defaults to the material field’s baby blue

    Declaration

    Swift

    public var borderHighlightColor: UIColor
  • Border color when there is an error in the field

    Note

    Defaults to UIColor.red

    Declaration

    Swift

    public var borderErrorColor: UIColor
  • Normal text color

    Note

    Defaults to UIColor.black

    Declaration

    Swift

    public var textColor: UIColor
  • Error text color

    Note

    Defaults to UIColor.red

    Declaration

    Swift

    public var errorTextColor: UIColor
  • Color of placeholder label when down

    Note

    Defaults to UIColor.gray

    Declaration

    Swift

    public var placeholderDownColor: UIColor
  • Color of placeholder label when up

    Note

    Defaults to UIColor.black

    Declaration

    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()