A collection of methods that defines features associated with keyboard input to a text object.


protocol UITextInputTraits


For a custom text object to support keyboard input, it must adopt this protocol to interact properly with the text input management system. The UITextField and UITextView classes automatically support this protocol.


Configuring the Keyboard Appearance

var keyboardType: UIKeyboardType

The keyboard style associated with the text object.

enum UIKeyboardType

The type of keyboard to display for a given text-based view. Used with the keyboardType property.

var keyboardAppearance: UIKeyboardAppearance

The appearance style of the keyboard that is associated with the text object

enum UIKeyboardAppearance

The appearance of the keyboard used by a text-based view. Used with the keyboardAppearance property.

var returnKeyType: UIReturnKeyType

The visible title of the Return key.

enum UIReturnKeyType

The text string displayed in the Return key of a keyboard. Used with the returnKeyType property.

var textContentType: UITextContentType!

The semantic meaning expected by a text input area.

struct UITextContentType

Constants that identify the semantic meaning expected for a text-entry area.

Managing the Keyboard Behavior

var isSecureTextEntry: Bool

Identifies whether the text object should disable text copying and in some cases hide the text being entered.

var enablesReturnKeyAutomatically: Bool

A Boolean value indicating whether the Return key is automatically enabled when the user is entering text.

Managing Spelling and Autocorrection

var autocapitalizationType: UITextAutocapitalizationType

The auto-capitalization style for the text object.

enum UITextAutocapitalizationType

The auto-capitalization behavior of a text-based view. Used with the autocapitalizationType property.

var autocorrectionType: UITextAutocorrectionType

The autocorrection style for the text object.

enum UITextAutocorrectionType

The autocorrection behavior of a text-based view. Used with the autocorrectionType property.

var spellCheckingType: UITextSpellCheckingType

The spell-checking style for the text object.

enum UITextSpellCheckingType

The spell-checking behavior of a text-based view. Used with the spellCheckingType property.

Configuring the Auto-Formatting Behaviors

var smartQuotesType: UITextSmartQuotesType

The configuration state for smart quotes.

enum UITextSmartQuotesType

Constants indicating whether smart quotes are enabled or disabled.

var smartDashesType: UITextSmartDashesType

The configuration state for smart dashes.

enum UITextSmartDashesType

Constants for specifying the automatic conversion behavior between hyphens and en or em dashes.

var smartInsertDeleteType: UITextSmartInsertDeleteType

The configuration state for the smart insertion and deletion of space characters.

enum UITextSmartInsertDeleteType

Constants for specifying whether extra spaces are automatically inserted after a paste operation or deleted after a cut or delete operation.

Configuring Password AutoFill

Password AutoFill

Streamline your app’s login and onboarding procedures.


Inherits From

Inherited By

Conforming Types

See Also


class UITextInputAssistantItem

An object that manages bar button items displayed in the shortcuts bar above the keyboard on iPad.