---
title: "insertText(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uikeyinput/inserttext(_:)"
---

# insertText(_:)

Inserts a character into the displayed text.

## Declaration

```swift
func insertText(_ text: String)
```

## Parameters

- `text`: A string object representing the character typed on the system keyboard.

## Mentioned in

Handling text interactions in custom keyboards

## Discussion

Discussion Add the character text to your class’s backing store at the index corresponding to the cursor and redisplay the text.

## See Also

### Inserting and deleting text

- [deleteBackward()](uikit/uikeyinput/deletebackward().md)
- [hasText](uikit/uikeyinput/hastext.md)
