---
title: clearsOnInsertion
framework: uikit
role: symbol
role_heading: Instance Property
path: uikit/uitextfield/clearsoninsertion
---

# clearsOnInsertion

A Boolean value that determines whether inserting text replaces the previous contents.

## Declaration

```swift
var clearsOnInsertion: Bool { get set }
```

## Discussion

Discussion The default value of this property is false. When the value of this property is true and the text field is in editing mode, the selection UI is hidden and inserting new text clears the contents of the text field and sets the value of this property back to false.

## See Also

### Managing the editing behavior

- [isEditing](uikit/uitextfield/isediting.md)
- [clearsOnBeginEditing](uikit/uitextfield/clearsonbeginediting.md)
- [allowsEditingTextAttributes](uikit/uitextfield/allowseditingtextattributes.md)
- [UITextField.DidEndEditingReason](uikit/uitextfield/didendeditingreason.md)
- [didEndEditingReasonUserInfoKey](uikit/uitextfield/didendeditingreasonuserinfokey.md)
- [textDidBeginEditingNotification](uikit/uitextfield/textdidbegineditingnotification.md)
- [textDidChangeNotification](uikit/uitextfield/textdidchangenotification.md)
- [textDidEndEditingNotification](uikit/uitextfield/textdidendeditingnotification.md)
