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

# attributedText

The styled text that the label 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, although 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. Turn autokerning on for the label by setting the NSKernAttributeName of the string to null.

## See Also

### Accessing the text attributes

- [text](uikit/uilabel/text.md)
- [font](uikit/uilabel/font.md)
- [textColor](uikit/uilabel/textcolor.md)
- [textAlignment](uikit/uilabel/textalignment.md)
- [lineBreakMode](uikit/uilabel/linebreakmode.md)
- [lineBreakStrategy](uikit/uilabel/linebreakstrategy.md)
- [isEnabled](uikit/uilabel/isenabled.md)
- [enablesMarqueeWhenAncestorFocused](uikit/uilabel/enablesmarqueewhenancestorfocused.md)
- [showsExpansionTextWhenTruncated](uikit/uilabel/showsexpansiontextwhentruncated.md)
