showDefinition(for:at:)
Shows a window displaying the definition of the attributed string at the specified point.
Declaration
func showDefinition(for attrString: NSAttributedString?, at textBaselineOrigin: NSPoint)Parameters
- attrString:
The attributed string for which to show the definition. If the view is an instance of NSTextView, the
attrStringcan benil, in which case the text view will automatically supply values suitable for displaying definitions for the specified range within its text content. - textBaselineOrigin:
Specifies the baseline origin of
attrStringin the view’s coordinate system.
Discussion
Shows a window that displays the definition (or other subject depending on available dictionaries) of the specified attributed string.
This method can be used for implementing the same functionality as the NSTextView “Look Up in Dictionary” contextual menu on a custom view.