textRange(for:enclosing:)
Returns a text range that corresponds to selection granularity of the enclosing location.
Declaration
func textRange(for selectionGranularity: NSTextSelection.Granularity, enclosing location: any NSTextLocation) -> NSTextRange?Parameters
- selectionGranularity:
One of the possible Granularity Swift.enum options.
- location:
A location that encloses the text range of interest.
Return Value
Returns the text range of the section, or nil when documentRange.isEmpty true.