---
title: "insertTextPlaceholder(with:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextinput/inserttextplaceholder(with:)"
---

# insertTextPlaceholder(with:)

Inserts a placeholder object to reserve visual space during text input.

## Declaration

```swift
optional func insertTextPlaceholder(with size: CGSize) -> UITextPlaceholder
```

## Parameters

- `size`: The size of the space to reserve.

## Return Value

Return Value The placeholder object that was inserted into the text input.

## Discussion

Discussion If the size.height is less than or equal to zero, then the placeholder displays inline using the current line’s height. If the size.height is greater than zero, then the text input treats the placeholder as a paragraph of height size.height.

## See Also

### Managing placeholders

- [remove(_:)](uikit/uitextinput/remove(_:).md)
- [UITextPlaceholder](uikit/uitextplaceholder.md)
