StandartTextField - admiral-team/admiralui-ios GitHub Wiki

Class

An object that displays an editable text area in your interface.

Declaration

open class TextField: TextFieldInput, AnyAppThemable, AccessibilitySupport

Overview

Text fields allow users to type text into an app. They are used to build forms, send messages, create search experiences, and more. In this recipe, explore how to create and style text fields. Text field contains input text, placeholder, input text, helper text or error message, right icon. Text fields allow users to type text into an app. They are used to build forms, send messages, create search experiences, and more. In this recipe, explore how to create and style text fields. Text field contains input text, placeholder, input text, helper text or error message, right view.

Live example

Configure a Text Field

Configuration a text field the similar UITextField. This example show how set text for input text, text for placeholder and text for helper text label.

let textField = TextField()
textField.text = "Text"
textField.placeholder = "Placeholder"
textField.info = "Info"

Text field may be in four state.

Default

The normal state of the field in which the user can edit textfield

textField.state = .normal

Read Only

The read only state disable user to modify textfield.

textField.state = .readOnly

Error

The error state is useful to show the user an error.

textField.state = .error

Disabled

The disabled state disable user input and hide input text.

textField.state = .disabled

Configure right view

You have the option to set any view on right side text field. For example, you can set info button with icon in right view for describe text field.

textField.trailingView = UIView()

Handle changing text

Handling text in text field the similar UITextField. Need set delegate

textField.delegate = self

After you can implementation methods from protocol TextFieldInputDelegate.

Contribution

You can help us to find bugs or ask us to add features.

  • To start issue please use ready-made templates.
  • To make changes to the repository, you need to create a fork of the project, make changes to the code and create a pull request in our project. You can read more about this in the Github documentation.