<!--
{
  "availability" : [
    "iOS: 17.4.0 -",
    "iPadOS: 17.4.0 -",
    "tvOS: 17.4.0 -",
    "visionOS: 1.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "BrowserEngineKit",
  "identifier" : "/documentation/BrowserEngineKit/BETextInput/moveSelection(atBoundary:in:completionHandler:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "BrowserEngineKit"
    ],
    "preciseIdentifier" : "c:objc(pl)BETextInput(im)moveSelectionAtBoundary:inStorageDirection:completionHandler:"
  },
  "title" : "moveSelection(atBoundary:in:completionHandler:)"
}
-->

# moveSelection(atBoundary:in:completionHandler:)

Moves the text-selection caret relative to the current position.

```
func moveSelection(atBoundary granularity: UITextGranularity, in direction: UITextStorageDirection, completionHandler: @escaping @Sendable () -> Void)
```

```
func moveSelection(atBoundary granularity: UITextGranularity, in direction: UITextStorageDirection) async
```

## Parameters

`granularity`

The amount by which to move the caret.

`direction`

The direction in which to move the caret, relative to the base writing direction.

`completionHandler`

A block you call when your text view has handled the gesture.

## Discussion

If you return `false` from [`textInteractionGesture(_:shouldBeginAt:)`](/documentation/BrowserEngineKit/BETextInput/textInteractionGesture(_:shouldBeginAt:)) for the gesture that moves the caret, then the text system doesn’t call this method.

---

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)