textSelection(for:enclosing:inContainerAt:)
Returns a text selection that expands to the nearest boundaries for selection granularity and an enclosing point you specify.
Declaration
func textSelection(for selectionGranularity: NSTextSelection.Granularity, enclosing point: CGPoint, inContainerAt location: any NSTextLocation) -> NSTextSelection?Parameters
- selectionGranularity:
One of the available Granularity Swift.enum options.
- point:
The point that encloses the text.
- location:
An Nstextlocation that describes the container.
Return Value
A new NSTextSelection, or nil if the text selection is not found.