rightView
The overlay view that displays on the right (or trailing) side of the text field.
Declaration
var rightView: UIView? { get set }Discussion
You can use the right overlay view to provide indicate additional features available for the text field. For example, you might display a bookmarks button in this location to allow the user to select from a set of predefined items. The right overlay view flips automatically in a right-to-left user interface.
The right overlay view is placed in the rectangle returned by the rightViewRect(forBounds:) method of the receiver. The image associated with this property should fit the given rectangle. If it does not fit, it is scaled to fit. If you specify a control for your view, that control tracks and sends actions as usual.
If your right overlay view overlaps a sibling view, such as the clear button, you must use the UITextField.ViewMode to implement proper behavior. For example, if clearButtonMode is set to display the clear button, you can set the right overlay view’s rightViewMode to UITextField.ViewMode.unlessEditing to reveal the clear button during editing when the text field has contents.