---
title: selectionGranularity
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nstextview/selectiongranularity
---

# selectionGranularity

The selection granularity for subsequent extension of a selection.

## Declaration

```swift
var selectionGranularity: NSSelectionGranularity { get set }
```

## Discussion

Discussion Selection granularity is used to determine how the selection is modified when the user Shift-clicks or drags the mouse after a double or triple click. For example, if the user selects a word by double-clicking, the selection granularity is set to NSSelectByWord. Subsequent Shift-clicks then extend the selection by words. Selection granularity is reset to NSSelectByCharacter whenever the selection is set. You should always set the selection granularity after setting the selection.

## See Also

### Managing the selection

- [selectedRanges](appkit/nstextview/selectedranges.md)
- [setSelectedRange(_:)](appkit/nstextview/setselectedrange(_:).md)
- [setSelectedRange(_:affinity:stillSelecting:)](appkit/nstextview/setselectedrange(_:affinity:stillselecting:).md)
- [setSelectedRanges(_:affinity:stillSelecting:)](appkit/nstextview/setselectedranges(_:affinity:stillselecting:).md)
- [selectionAffinity](appkit/nstextview/selectionaffinity.md)
- [insertionPointColor](appkit/nstextview/insertionpointcolor.md)
- [updateInsertionPointStateAndRestartTimer(_:)](appkit/nstextview/updateinsertionpointstateandrestarttimer(_:).md)
- [selectedTextAttributes](appkit/nstextview/selectedtextattributes.md)
- [markedTextAttributes](appkit/nstextview/markedtextattributes.md)
- [linkTextAttributes](appkit/nstextview/linktextattributes.md)
- [characterIndexForInsertion(at:)](appkit/nstextview/characterindexforinsertion(at:).md)
- [updateCandidates()](appkit/nstextview/updatecandidates().md)
