Coordinator

class Coordinator: NSObject, NSTextViewDelegate

The coordinator for the ChordProEditor

Protocol Functions

  • 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