smartInsert(afterStringFor:replacing:)
Returns any whitespace that needs to be added after the string to preserve proper spacing and punctuation when the string replaces the characters in the specified range.
Declaration
func smartInsert(afterStringFor pasteString: String, replacing charRangeToReplace: NSRange) -> String?Parameters
- pasteString:
The string that is replacing the characters in
charRange. - charRangeToReplace:
The range of characters which
aStringis replacing.
Return Value
Any whitespace that needs to be added after aString to preserve proper spacing and punctuation when the characters in charRange are replaced by aString. If aString is nil or if smart insertion and deletion are disabled, this method returns nil.
Discussion
Don’t invoke this method directly. Instead, use smartInsert(for:replacing:before:after:), which calls this method as part of its implementation.
See Also
Customizing subclass behaviors
updateFontPanel()updateRuler()acceptableDragTypesupdateDragTypeRegistration()selectionRange(forProposedRange:granularity:)rangeForUserCharacterAttributeChangerangesForUserCharacterAttributeChangerangeForUserParagraphAttributeChangerangesForUserParagraphAttributeChangerangeForUserTextChangerangesForUserTextChangeshouldChangeText(in:replacementString:)shouldChangeText(inRanges:replacementStrings:)didChangeText()smartInsertDeleteEnabled