<!--
{
  "availability" : [
    "macOS: 10.8.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSTextViewDelegate/textView(_:willShow:forItems:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(pl)NSTextViewDelegate(im)textView:willShowSharingServicePicker:forItems:"
  },
  "title" : "textView(_:willShow:forItems:)"
}
-->

# textView(_:willShow:forItems:)

Returns a sharing service picker for the current selection.

```
@MainActor optional func textView(_ textView: NSTextView, willShow servicePicker: NSSharingServicePicker, forItems items: [Any]) -> NSSharingServicePicker?
```

## Parameters

`textView`

The text view.

`servicePicker`

The service picker.

`items`

The ranges of the items to share.

## Return Value

An [`NSSharingServicePicker`](/documentation/AppKit/NSSharingServicePicker) instance. The original sharing picker or a new sharing picker instance can be returned.

## Discussion

Returns a sharing service picker created for items right before shown to the screen when the `orderFrontSharingServicePicker:` method. Return `nil` to remove the Share item from the menu.

The delegate is specified as the delegate for the `NSSharingServicePicker` instance.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)