Coordinator
class Coordinator: NSObject, NSTextViewDelegate
The coordinator for the ChordProEditor
-
The parent
Declaration
Swift
var parent: ChordProEditor
-
The optional balance string, close a
{
or[
Declaration
Swift
private var balance: String?
-
Bool if the whole text must be (re)highlighted or just the current fragment
Declaration
Swift
private var fullHighlight: Bool = true
-
Debounce task for the text update
Declaration
Swift
var task: Task<Void, Never>?
-
Init the coordinator
Declaration
Swift
init(_ parent: ChordProEditor)
Parameters
parent
The
ChordProEditor
-
Allows delegate to control the context menu returned by menuForEvent
Declaration
Swift
func textView(_ view: NSTextView, menu: NSMenu, for event: NSEvent, at charIndex: Int) -> NSMenu?
Parameters
view
The
NSTextView
menu
The
NSMenu
event
The event
charIndex
The index of the character that was right-clicked
Return Value
The altered
NSMenu
-
Protocol function to check if a text should change
Declaration
Swift
func textView( _ textView: NSTextView, shouldChangeTextIn affectedCharRange: NSRange, replacementString: String? ) -> Bool
Parameters
textView
The
NSTextView
affectedCharRange
The character range that is affected
replacementString
The optional replacement string
Return Value
True or false
-
Protocol function with a notification that the text has changed
Declaration
Swift
func textDidChange(_ notification: Notification)
Parameters
notification
The notification with the
NSTextView
as object -
Protocol function with a notification that the text selection has changed
Declaration
Swift
func textViewDidChangeSelection(_ notification: Notification)
Parameters
notification
The notification with the
NSTextView
as object