---
title: "setBaseWritingDirection(_:range:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextview/setbasewritingdirection(_:range:)"
---

# setBaseWritingDirection(_:range:)

Sets the base writing direction of a range of text.

## Declaration

```swift
func setBaseWritingDirection(_ writingDirection: NSWritingDirection, range: NSRange)
```

## Parameters

- `writingDirection`: The new writing direction for the text in range.
- `range`: The range of text that will have the new writing direction.

## Discussion

Discussion Invoke this method to change the base writing direction from left-to-right to right-to-left for languages like Hebrew and Arabic, for example. This method does not include undo support by default. Clients must invoke shouldChangeText(inRanges:replacementStrings:) or shouldChangeText(in:replacementString:) to include this method in an undoable action.

## See Also

### Setting behavioral attributes

- [allowsUndo](appkit/nstextview/allowsundo.md)
- [isEditable](appkit/nstextview/iseditable.md)
- [isSelectable](appkit/nstextview/isselectable.md)
- [isFieldEditor](appkit/nstextview/isfieldeditor.md)
- [isRichText](appkit/nstextview/isrichtext.md)
- [importsGraphics](appkit/nstextview/importsgraphics.md)
- [defaultParagraphStyle](appkit/nstextview/defaultparagraphstyle.md)
- [outline(_:)](appkit/nstextview/outline(_:).md)
- [allowsImageEditing](appkit/nstextview/allowsimageediting.md)
- [isAutomaticQuoteSubstitutionEnabled](appkit/nstextview/isautomaticquotesubstitutionenabled.md)
- [toggleAutomaticQuoteSubstitution(_:)](appkit/nstextview/toggleautomaticquotesubstitution(_:).md)
- [isAutomaticLinkDetectionEnabled](appkit/nstextview/isautomaticlinkdetectionenabled.md)
- [toggleAutomaticLinkDetection(_:)](appkit/nstextview/toggleautomaticlinkdetection(_:).md)
- [displaysLinkToolTips](appkit/nstextview/displayslinktooltips.md)
- [isAutomaticTextCompletionEnabled](appkit/nstextview/isautomatictextcompletionenabled.md)
