---
title: "replace(_:withAttributedText:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextinput/replace(_:withattributedtext:)"
---

# replace(_:withAttributedText:)

## Declaration

```swift
optional func replace(_ range: UITextRange, withAttributedText attributedText: NSAttributedString)
```
