---
title: selectionRange()
framework: InputMethodKit
role: symbol
role_heading: Instance Method
platforms: [macOS 10.5+]
path: inputmethodkit/imkinputcontroller/selectionrange()
---

# selectionRange()

Returns where the range of the selection that should be placed inside marked text.

## Declaration

```swift
func selectionRange() -> NSRange
```

## Return Value

Return Value The range of the selection.

## Discussion

Discussion This method is called by updateComposition() to obtain the selection range for marked text. The default implementation sets the selection range at the end of the marked text. You should override this method if your input method provides font or glyph information.

## See Also

### Working with Ranges

- [compositionAttributes(at:)](inputmethodkit/imkinputcontroller/compositionattributes(at:).md)
- [replacementRange()](inputmethodkit/imkinputcontroller/replacementrange().md)
- [mark(forStyle:at:)](inputmethodkit/imkinputcontroller/mark(forstyle:at:).md)
