RSDTextFieldOptionsObject

public struct RSDTextFieldOptionsObject : RSDTextFieldOptions, Codable

RSDTextFieldOptionsObject defines the options for a text field.

Seealso

RSDInputField and RSDFormStepDataSource
  • A text validator that can be used to validate a string.

    Declaration

    Swift

    public var textValidator: RSDTextValidator?
  • The text presented to the user when invalid input is received.

    Declaration

    Swift

    public var invalidMessage: String?
  • The maximum length of the text users can enter. When the value of this property is 0, there is no maximum.

    Declaration

    Swift

    public var maximumLength: Int
  • Auto-capitalization type for the text field.

    Declaration

    Swift

    public var autocapitalizationType: RSDTextAutocapitalizationType
  • Auto-correction type for the text field.

    Declaration

    Swift

    public var autocorrectionType: RSDTextAutocorrectionType
  • Spell checking type for the text field.

    Declaration

    Swift

    public var spellCheckingType: RSDTextSpellCheckingType
  • Keyboard type for the text field.

    Declaration

    Swift

    public var keyboardType: RSDKeyboardType
  • Is the text field for password entry?

    Declaration

    Swift

    public var isSecureTextEntry: Bool
  • Default initializer.

    Declaration

    Swift

    public init(keyboardType: RSDKeyboardType = .default, autocapitalizationType: RSDTextAutocapitalizationType = .none, isSecureTextEntry: Bool = false, maximumLength: Int = 0, spellCheckingType: RSDTextSpellCheckingType = .no, autocorrectionType: RSDTextAutocorrectionType = .no)

    Parameters

    keyboardType

    Keyboard type for the text field.

    autocapitalizationType

    Auto-capitalization type for the text field.

    isSecureTextEntry

    Is the text field for password entry?

    spellCheckingType

    Spell checking type for the text field.

    autocorrectionType

    Auto-correction type for the text field.

  • Initialize from a Decoder. The decoder uses string value keywords for all the Int base enums defined by this struct where the keywords listed in the table below.

    Property Keywords
    keyboardType [ default, asciiCapable, numbersAndPunctuation, URL,
                               "numberPad", "phonePad", "namePhonePad", "emailAddress",
                               "decimalPad", "twitter", "webSearch", "asciiCapableNumberPad"]   |
    

    | autocapitalizationType | [none, words, sentences, allCharacters] | | spellCheckingType | [default, no, yes] | | autocorrectionType | [default, no, yes] |

  • example:

           let json = """
               {
               "textValidator" : "[A:C]",
               "invalidMessage" : "You know me",
               "maximumLength" : 10,
               "autocapitalizationType" : "words",
               "keyboardType" : "asciiCapable",
               "isSecureTextEntry" : true
               }
           """.data(using: .utf8)! // our data in native (JSON) format
    
  • Throws

    DecodingError

    Declaration

    Swift

    public init(from decoder: Decoder) throws

    Parameters

    decoder

    The decoder to use to decode this instance.

  • Encode the result to the given encoder. This will encode the text options as a dictionary.

    Throws

    EncodingError

    Declaration

    Swift

    public func encode(to encoder: Encoder) throws

    Parameters

    encoder

    The encoder to use to encode this instance.