Structure
DSUITextField
@available(iOS 13.0, tvOS 13.0, *)
public struct DSUITextField: View
An Enterprise-styled text entry element for use in SwiftUI views. It provides a placeholder label, helper text that sits below it that educates the user on what text to enter, and DSInputMask and DSValidationRule rules which will determine user input format and display errors when validations failed.
The field defaults to single-line, but if isMultiline is set to true the field will grow vertically as text is entered and space is required.
Use the DSInputMask framework to control text input based on the type of data being entered. There are many built-in rules to use or you can implement your own.
Use the DSValidationRule framework to add one or more validation checks. There are many built-in rules to use or you can implement your own.
Since this component can shrink and grow vertically to accommodate its contents, it's recommended that the DSTextField be embedded in a ScrollView that makes it easy for its contents to resize smoothly vertically. The component internally uses the DSTextFieldDelegate method textFieldDidLayout which gets called when the size changes.
Initialize and set parameters as needed.
DSUITextField(text: $step1Config.groupNumber,
labelText: "Group Number",
helperText: "Up to 5 characters, typing will stop",
isMultiline: true, inputMask: DSMaxTextLengthInputMask(maxTextLength: 5),
validationRules: [DSRequiredTextValidationRule(message: "This Text is required")],
isValid: $step1Config.isGroupNumberTextValid,
customizeTextEntry: customizeTextEntry,
customizeTextField: customizeTextField,
customizeTextView: customizeTextView)
Relationships
Conforms To
View
Initializers
Properties
inputMask
public var inputMask: DSInputMask?
An input mask that formats entered text and/or prevents certain characters from being entered at all
validationRules
public var validationRules: [DSValidationRule]
The array of ValidationRule objects to be used for validating the current state of the DSTextField contents.
body
public var body: some View