The UITextInputTraits protocol defines features associated with keyboard input to a text object.


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.


Managing the Keyboard Behavior

var autocapitalizationType: UITextAutocapitalizationType

The auto-capitalization style for the text object.

var autocorrectionType: UITextAutocorrectionType

The autocorrection style for the text object.

var spellCheckingType: UITextSpellCheckingType

The spell-checking style for the text object.

var enablesReturnKeyAutomatically: Bool

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

var keyboardAppearance: UIKeyboardAppearance

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

var keyboardType: UIKeyboardType

The keyboard style associated with the text object.

var returnKeyType: UIReturnKeyType

The visible title of the Return key.

var isSecureTextEntry: Bool

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

var textContentType: UITextContentType!

Indicates the semantic meaning expected by a text-entry area.



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


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


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


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


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


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

Text Content Types

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


Inherits From

Adopted By