---
title: textSelectionAffinity
framework: swiftui
role: symbol
role_heading: Instance Property
path: swiftui/environmentvalues/textselectionaffinity
---

# textSelectionAffinity

A representation of the direction or association of a selection or cursor relative to a text character. This concept becomes much more prominent when dealing with bidirectional text (text that contains both LTR and RTL scripts, like English and Arabic combined).

## Declaration

```swift
var textSelectionAffinity: TextSelectionAffinity { get set }
```

## Discussion

Discussion You can configure the selection affinity on a given hierarchy by using the textSelectionAffinity(_:) modifier.

## See Also

### Selecting text

- [textSelection(_:)](swiftui/view/textselection(_:).md)
- [TextSelectability](swiftui/textselectability.md)
- [TextSelection](swiftui/textselection.md)
- [textSelectionAffinity(_:)](swiftui/view/textselectionaffinity(_:).md)
- [TextSelectionAffinity](swiftui/textselectionaffinity.md)
- [AttributedTextSelection](swiftui/attributedtextselection.md)
