---
title: "textView(_:willDisplayToolTip:forCharacterAt:)"
framework: appkit
role: symbol
role_heading: Instance Method
path: "appkit/nstextviewdelegate/textview(_:willdisplaytooltip:forcharacterat:)"
---

# textView(_:willDisplayToolTip:forCharacterAt:)

Returns the actual tooltip to display.

## Declaration

```swift
@MainActor optional func textView(_ textView: NSTextView, willDisplayToolTip tooltip: String, forCharacterAt characterIndex: Int) -> String?
```

## Parameters

- `textView`: The text view sending the message.
- `tooltip`: The proposed tooltip to display.
- `characterIndex`: The location in textView.

## Return Value

Return Value The actual tooltip to display, or nil to suppress display of the tooltip.

## Discussion

Discussion The tooltip string is the value of the toolTip attribute at characterIndex.
