<!--
{
  "availability" : [
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WatchKit",
  "identifier" : "/documentation/WatchKit/WKInterfaceLabel/setAttributedText(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "WatchKit"
    ],
    "preciseIdentifier" : "c:objc(cs)WKInterfaceLabel(im)setAttributedText:"
  },
  "title" : "setAttributedText(_:)"
}
-->

# setAttributedText(_:)

Sets the label text to the specified attributed string.

```
func setAttributedText(_ attributedText: NSAttributedString?)
```

## Parameters

`attributedText`

The formatted text string to be displayed in the label. Specifying `nil` clears the current text from the label.

## Discussion

This method changes the label text to the new value, replacing the old text if any. Any font and style attributes applied to the string take precedence over default values. If you do not explicitly specify font or styling information, the default values are used instead. For example, if you do not specify a text color explicitly, the default text color is used.

Attributed strings may not contain any <doc://com.apple.documentation/documentation/UIKit/NSTextAttachment> objects as part of their content.

---

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)