---
title: "selectionWillChange(_:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/uitextinputdelegate/selectionwillchange(_:)"
---

# selectionWillChange(_:)

Tells the input delegate when the selection is about to change in the document.

## Declaration

```swift
func selectionWillChange(_ textInput: (any UITextInput)?)
```

## Parameters

- `textInput`: The document instance whose class adopts the UITextInput protocol.

## See Also

### Related Documentation

- [textWillChange(_:)](uikit/uitextinputdelegate/textwillchange(_:).md)

### Notifying the delegate of selection changes

- [selectionDidChange(_:)](uikit/uitextinputdelegate/selectiondidchange(_:).md)
