<!--
{
  "availability" : [
    "iOS: 18.0.0 -",
    "iPadOS: 18.0.0 -",
    "macCatalyst: 18.0.0 -",
    "macOS: 15.0.0 -",
    "tvOS: 18.0.0 -",
    "visionOS: 2.0.0 -",
    "watchOS: 11.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/TextSelectionAffinity/upstream",
  "metadataVersion" : "0.1.0",
  "role" : "Case",
  "symbol" : {
    "kind" : "Case",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI21TextSelectionAffinityO8upstreamyA2CmF"
  },
  "title" : "TextSelectionAffinity.upstream"
}
-->

# TextSelectionAffinity.upstream

An upstream selection affinity. In this case, the cursor is associated
with the character immediately before it.

```
case upstream
```

## Discussion

In the context of our example  `hello|مرحبا`, with an upstream affinity,
the cursor would be associated with the “o” from “hello”. If you were
to type in English, the characters would continue to be added after the “o” in “hello”.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)