Text field Preview
A text field lets people enter short, free-form text data.
Text fields don’t limit the amount of text that someone can enter, but they don’t respond to accommodate long text. For long inputs, like comments, try the native text view.
Usage
The Text Field has four closure properties that allow clients to respond to specific events from the UITextField:
/// The closure for the action to be called in response to the textfield's `.editingChanged` event.
@objc public var onEditingChanged: ((FluentTextField) -> Void)?
/// The closure for the action to be called in `textFieldDidBeginEditing`.
@objc public var onDidBeginEditing: ((FluentTextField) -> Void)?
/// The closure for the action to be called in `textFieldDidEndEditing`.
@objc public var onDidEndEditing: ((FluentTextField) -> Void)?
/// The closure for the action to be called in `textFieldShouldReturn`. The return value of `onReturn`
/// will be returned in `textFieldShouldReturn`.
@objc public var onReturn: ((FluentTextField) -> Bool)?
The UITextField that the Text Field uses is actually a custom subclass of the UITextField, the FluentTextFieldInternal, so that the position of the trailing clear text button could be customized.
Control name
FluentTextField
in Swift,
MSFTextField
in Objective C.