<!--
{
  "availability" : [
    "iOS: -",
    "iPadOS: -",
    "macCatalyst: -",
    "tvOS: -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextInputTraits",
  "metadataVersion" : "0.1.0",
  "role" : "Protocol",
  "symbol" : {
    "kind" : "Protocol",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(pl)UITextInputTraits"
  },
  "title" : "UITextInputTraits"
}
-->

# UITextInputTraits

A set of methods that defines features for keyboard input to a text object.

```
@MainActor protocol UITextInputTraits : NSObjectProtocol
```

## Overview

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`](/documentation/UIKit/UITextField) and [`UITextView`](/documentation/UIKit/UITextView) classes automatically support this protocol.

## Topics

### Configuring the keyboard appearance

[`keyboardType`](/documentation/UIKit/UITextInputTraits/keyboardType)

The keyboard type for the text object.

[`UIKeyboardType`](/documentation/UIKit/UIKeyboardType)

Constants that specify the type of keyboard to display for a text-based view.

[`keyboardAppearance`](/documentation/UIKit/UITextInputTraits/keyboardAppearance)

The appearance style of the keyboard for the text object.

[`UIKeyboardAppearance`](/documentation/UIKit/UIKeyboardAppearance)

Constants that specify the appearance of the keyboard for a text-based view.

[`returnKeyType`](/documentation/UIKit/UITextInputTraits/returnKeyType)

The visible indication of what the Return key does.

[`UIReturnKeyType`](/documentation/UIKit/UIReturnKeyType)

Constants that specify the type of Return key the keyboard displays.

[`textContentType`](/documentation/UIKit/UITextInputTraits/textContentType)

The semantic meaning for a text input area.

[`UITextContentType`](/documentation/UIKit/UITextContentType)

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

### Managing the keyboard behavior

[`isSecureTextEntry`](/documentation/UIKit/UITextInputTraits/isSecureTextEntry)

A Boolean value that indicates whether a text object disables copying, and in some cases, prevents recording/broadcasting and also hides the text.

[`enablesReturnKeyAutomatically`](/documentation/UIKit/UITextInputTraits/enablesReturnKeyAutomatically)

A Boolean value that indicates whether the system automatically enables the Return key when the user enters text.

### Managing spelling and autocorrection

[`autocapitalizationType`](/documentation/UIKit/UITextInputTraits/autocapitalizationType)

The autocapitalization style for the text object.

[`UITextAutocapitalizationType`](/documentation/UIKit/UITextAutocapitalizationType)

The autocapitalization behavior of a text-based view.

[`autocorrectionType`](/documentation/UIKit/UITextInputTraits/autocorrectionType)

The autocorrection style for the text object.

[`UITextAutocorrectionType`](/documentation/UIKit/UITextAutocorrectionType)

The autocorrection behavior of a text-based view.

[`spellCheckingType`](/documentation/UIKit/UITextInputTraits/spellCheckingType)

The spell-checking style for the text object.

[`UITextSpellCheckingType`](/documentation/UIKit/UITextSpellCheckingType)

The spell-checking behavior of a text-based view.

[`inlinePredictionType`](/documentation/UIKit/UITextInputTraits/inlinePredictionType)

The behavior of inline text predictions for a text-entry area.

[`UITextInlinePredictionType`](/documentation/UIKit/UITextInlinePredictionType)

Constants that identify the behavior of inline text predictions for a text-entry area.

### Configuring the autoformatting behaviors

[`smartQuotesType`](/documentation/UIKit/UITextInputTraits/smartQuotesType)

The configuration state for smart quotes.

[`UITextSmartQuotesType`](/documentation/UIKit/UITextSmartQuotesType)

Constants that indicate whether to enable or disable smart quotes.

[`smartDashesType`](/documentation/UIKit/UITextInputTraits/smartDashesType)

The configuration state for smart dashes.

[`UITextSmartDashesType`](/documentation/UIKit/UITextSmartDashesType)

Constants that specify the automatic conversion behavior between hyphens and en or em dashes.

[`smartInsertDeleteType`](/documentation/UIKit/UITextInputTraits/smartInsertDeleteType)

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

[`UITextSmartInsertDeleteType`](/documentation/UIKit/UITextSmartInsertDeleteType)

Constants that specify whether to automatically insert extra spaces after a paste operation or to delete them after a cut or delete operation.

### Configuring the writing tools experience

[`writingToolsBehavior`](/documentation/UIKit/UITextInputTraits/writingToolsBehavior)

The writing tools experience to support in the current view.

[`UIWritingToolsBehavior`](/documentation/UIKit/UIWritingToolsBehavior)

Constants that specify the writing tools experience for the underlying view.

### Configuring Smart Replies

[`conversationContext`](/documentation/UIKit/UITextInputTraits/conversationContext)

A reference to a conversation, such as a mail or messaging thread.

### Configuring Password AutoFill

  <doc://com.apple.documentation/documentation/Security/password-autofill>

[`UITextInputPasswordRules`](/documentation/UIKit/UITextInputPasswordRules)

A class that represents password rules for a text input field.

### Configuring math expression completion

[`mathExpressionCompletionType`](/documentation/UIKit/UITextInputTraits/mathExpressionCompletionType)

[`UITextMathExpressionCompletionType`](/documentation/UIKit/UITextMathExpressionCompletionType)



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)