---
title: "deletionRanges(for:direction:destination:allowsDecomposition:)"
framework: uikit
role: symbol
role_heading: Instance Method
path: "uikit/nstextselectionnavigation/deletionranges(for:direction:destination:allowsdecomposition:)"
---

# deletionRanges(for:direction:destination:allowsDecomposition:)

Returns the ranges for deleting the text based on the current selection and movement arguments.

## Declaration

```swift
func deletionRanges(for textSelection: NSTextSelection, direction: NSTextSelectionNavigation.Direction, destination: NSTextSelectionNavigation.Destination, allowsDecomposition: Bool) -> [NSTextRange]
```

## Parameters

- `textSelection`: The text selection.
- `direction`: The doc://com.apple.uikit/documentation/UIKit/NSTextSelectionNavigation/Direction to consider when calculating the deletion ranges.
- `destination`: The doc://com.apple.uikit/documentation/UIKit/NSTextSelectionNavigation/Destination that describes the scope of the text selection to consider when calculating the deletion ranges.
- `allowsDecomposition`: A Boolean value that determines if this method operates on composite characters which may be present depending on the characteristics of the script used by textSelection.

## Return Value

Return Value An array of text ranges to delete.

## Discussion

Discussion The selection after deletion contains a zero-length range starting at the location of the first range returned. The framework ignores the destination when textSelection has a non-empty selection. The allowsDecomposition parameter only applies to the NSTextSelectionNavigation.Direction.backward direction and NSTextSelectionNavigation.Destination.character with a zero-length selection.
