A set of optional methods that text view delegates can use to manage selection, set text attributes, work with the spell checker, and more.
SDK
- macOS 10.6+
Framework
- App
Kit
Declaration
protocol NSTextViewDelegate
A set of optional methods that text view delegates can use to manage selection, set text attributes, work with the spell checker, and more.
SDK
Framework
protocol NSTextViewDelegate
func undo Manager(for: NSText View) -> Undo Manager?
Returns the undo manager for the specified text view.
func text View(NSText View, will Display Tool Tip: String, for Character At: Int) -> String?
Returns the actual tooltip to display.
func text View(NSText View, url For Contents Of: NSText Attachment, at: Int) -> URL?
Returns a URL representing the document contents for a text attachment.
func text View(NSText View, will Change Selection From Character Range: NSRange, to Character Range: NSRange) -> NSRange
Returns the actual range to select.
func text View(NSText View, will Change Selection From Character Ranges: [NSValue], to Character Ranges: [NSValue]) -> [NSValue]
Returns the actual character ranges to select.
func text View Did Change Selection(Notification)
Sent when the selection changes in the text view.
func text View(NSText View, writable Pasteboard Types For: NSText Attachment Cell Protocol, at: Int) -> [NSPasteboard .Pasteboard Type]
Returns the writable pasteboard types for a given cell.
func text View(NSText View, write: NSText Attachment Cell Protocol, at: Int, to: NSPasteboard, type: NSPasteboard .Pasteboard Type) -> Bool
Returns whether data of the specified type for the given cell could be written to the specified pasteboard.
func text View(NSText View, should Change Text In: NSRange, replacement String: String?) -> Bool
Sent when a text view needs to determine if text in a specified range should be changed.
func text View(NSText View, should Change Text In Ranges: [NSValue], replacement Strings: [String]?) -> Bool
Sent when a text view needs to determine if text in an array of specified ranges should be changed.
func text View(NSText View, should Change Typing Attributes: [String : Any], to Attributes: [NSAttributed String .Key : Any]) -> [NSAttributed String .Key : Any]
Sent when the typing attributes are changed.
func text View Did Change Typing Attributes(Notification)
Sent when a text view’s typing attributes change.
func text View(NSText View, clicked On: NSText Attachment Cell Protocol, in: NSRect, at: Int)
Sent when the user clicks a cell.
func text View(NSText View, double Clicked On: NSText Attachment Cell Protocol, in: NSRect, at: Int)
Sent when the user double-clicks a cell.
func text View(NSText View, clicked On Link: Any, at: Int) -> Bool
Sent after the user clicks a link.
func text View(NSText View, should Set Spelling State: Int, range: NSRange) -> Int
Sent when the spelling state is changed.
func text View(NSText View, will Check Text In: NSRange, options: [NSSpell Checker .Option Key : Any], types: Unsafe Mutable Pointer<NSText Checking Types>) -> [NSSpell Checker .Option Key : Any]
Invoked to allow the delegate to modify the text checking process before it occurs.
func text View(NSText View, did Check Text In: NSRange, types: NSText Checking Types, options: [NSSpell Checker .Option Key : Any], results: [NSText Checking Result], orthography: NSOrthography, word Count: Int) -> [NSText Checking Result]
Invoked to allow the delegate to modify the text checking results after checking has occurred.
func text View(NSText View, dragged Cell: NSText Attachment Cell Protocol, in: NSRect, event: NSEvent, at: Int)
Sent when the user attempts to drag a cell.
func text View(NSText View, completions: [String], for Partial Word Range: NSRange, index Of Selected Item: Unsafe Mutable Pointer<Int>?) -> [String]
Returns the actual completions for a partial word.
func text View(NSText View, will Show: NSSharing Service Picker, for Items: [Any]) -> NSSharing Service Picker?
Returns a sharing service picker for the current selection.
func text View(NSText View, do Command By: Selector) -> Bool
Sent to allow the delegate to perform the command for the text view.
func text View(NSText View, menu: NSMenu, for: NSEvent, at: Int) -> NSMenu?
Allows delegate to control the context menu returned by the text view.
class NSText Field
Text that the user can select or edit and that sends its action message to its target when the user presses the Return key.
protocol NSText Field Delegate
A protocol that a text field delegate can use to control its field editor action menu.
class NSText View
A view that draws text and handles user interactions with that text.
class NSText
The most general programmatic interface for objects that manage text.