---
title: attributedText
framework: uikit
role: symbol
role_heading: Instance Property
path: uikit/uitextfield/attributedtext
---

# attributedText

The styled text that the text field displays.

## Declaration

```swift
@NSCopying var attributedText: NSAttributedString? { get set }
```

## Discussion

Discussion This property is nil by default. Assigning a new value to this property also replaces the value of the text property with the same string data, albeit without any formatting information. In addition, assigning a new value updates the values in the font, textColor, and other style-related properties so that they reflect the style information starting at location 0 in the attributed string.

## See Also

### Configuring the text attributes

- [text](uikit/uitextfield/text.md)
- [placeholder](uikit/uitextfield/placeholder.md)
- [attributedPlaceholder](uikit/uitextfield/attributedplaceholder.md)
- [defaultTextAttributes](uikit/uitextfield/defaulttextattributes.md)
- [font](uikit/uitextfield/font.md)
- [textColor](uikit/uitextfield/textcolor.md)
- [textAlignment](uikit/uitextfield/textalignment.md)
- [typingAttributes](uikit/uitextfield/typingattributes.md)
- [UITextField.BorderStyle](uikit/uitextfield/borderstyle-swift.enum.md)
