Contents

destinationSelection(for:direction:destination:extending:confined:)

Returns a new selection that results from applying the navigation operations you specify to the text selection you provide.

Declaration

func destinationSelection(for textSelection: NSTextSelection, direction: NSTextSelectionNavigation.Direction, destination: NSTextSelectionNavigation.Destination, extending: Bool, confined: Bool) -> NSTextSelection?

Parameters

  • textSelection:

    The source selection.

  • direction:

    One of the available Direction directions.

  • destination:

    One of the available Destination destinations.

  • extending:

    Whether this selection extends an existing selection.

  • confined:

    Whether to confine movement to the existing selection.

Return Value

A new NSTextSelection, or nil if the operation doesn’t produce a logically valid result.

Discussion

If confined is true, confine any movement to the text element that the selection already lies within.

See Also

Working with text selections