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
parentThe
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
viewThe
NSTextViewmenuThe
NSMenueventThe event
charIndexThe 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? ) -> BoolParameters
textViewThe
NSTextViewaffectedCharRangeThe character range that is affected
replacementStringThe 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
notificationThe notification with the
NSTextViewas object -
Protocol function with a notification that the text selection has changed
Declaration
Swift
func textViewDidChangeSelection(_ notification: Notification)Parameters
notificationThe notification with the
NSTextViewas object
View on GitHub