Contents

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 aString is 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