---
title: "setAttributedText(_:)"
framework: watchkit
role: symbol
role_heading: Instance Method
path: "watchkit/wkinterfacetextfield/setattributedtext(_:)"
---

# setAttributedText(_:)

Sets the styled text displayed by the text field.

## Declaration

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

## Parameters

- `attributedText`: The styled text displayed in the text field. Specifying nil clears the current text.

## See Also

### Setting the Text

- [setText(_:)](watchkit/wkinterfacetextfield/settext(_:).md)
- [setTextColor(_:)](watchkit/wkinterfacetextfield/settextcolor(_:).md)
