<!--
{
  "availability" : [
    "iOS: 2.0.0 -",
    "iPadOS: 2.0.0 -",
    "macCatalyst: 13.1.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "UIKit",
  "identifier" : "/documentation/UIKit/UITextField/text",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "UIKit"
    ],
    "preciseIdentifier" : "c:objc(cs)UITextField(py)text"
  },
  "title" : "text"
}
-->

# text

The text that the text field displays.

```
var text: String? { get set }
```

## Discussion

Assigning a new value to this property also replaces the value of the [`attributedText`](/documentation/UIKit/UITextField/attributedText) property with the same text, albeit without any inherent style attributes. Instead the text view styles the new string using the [`font`](/documentation/UIKit/UITextField/font), [`textColor`](/documentation/UIKit/UITextField/textColor), and other style-related properties of the class.

This value is `nil` by default.

---

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)