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

# setText(_:)

Sets the text displayed by the text field.

## Declaration

```swift
func setText(_ text: String?)
```

## Parameters

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

## See Also

### Setting the Text

- [setAttributedText(_:)](watchkit/wkinterfacetextfield/setattributedtext(_:).md)
- [setTextColor(_:)](watchkit/wkinterfacetextfield/settextcolor(_:).md)
