replaceSelection(withText:)
Replaces the current selection with a string of text.
Declaration
func replaceSelection(withText text: String!)Parameters
- text:
The text that replaces the current selection.
Discussion
If the current selection is collapsed (a range is selected with the same nodes and offsets for the start and end) then no content is removed when inserting the text, and the selection is collapsed and moved to the end of the inserted content. If no content is selected, the text is not inserted.
See Also
Editing Documents
replaceSelection(with:)replaceSelection(withMarkupString:)replaceSelection(with:)deleteSelection()moveToBeginningOfSentence(_:)moveToBeginningOfSentenceAndModifySelection(_:)moveToEndOfSentence(_:)moveToEndOfSentenceAndModifySelection(_:)selectSentence(_:)toggleContinuousSpellChecking(_:)toggleSmartInsertDelete(_:)canMakeTextStandardSizemakeTextStandardSize(_:)maintainsInactiveSelection