Components
A control that allows single line text input.
The single line text input control TextInput
is build upon the built-in UIKit component UITextField
.
let textInput = TextInput()
The placeholder text that’s shown when no text has been entered. Placeholder text is shown in gray.
textInput.placeholder = "Type something..."
If true, the control will be red. Use this property if something’s wrong and the text input control needs a user’s attention.
textInput.hasError = true
If false, the control will not react to user interaction and will have a light gray color.
textInput.isEnabled = false
If true, the control has a blue border.
textInput.isHighlighted = true
These properties are inherited from UITextField
and typically make it possible to show image based buttons on both sides of the text. More info can be found in the official UITextField documentation.
let leftView = UIButton(type: .system)leftView.setTitle("left", for: .normal)textInput.leftView = leftViewtextInput.leftViewMode = .always
This property is inherited from UITextField
and determines when the standard clear button appears. More info can be found in the official UITextField documentation.
textInput.clearButtonMode = .whileEditing
Suppresses the cursor display while the control is active.
textInput.hidesCaret = true