ChordProEditor
struct ChordProEditor: NSViewRepresentable
SwiftUI NSViewRepresentable
for the ChordPro editor
-
The
Binding
to the text of the documentDeclaration
Swift
var text: String
-
The parsed song lines
Declaration
Swift
let lines: [Song.Section.Line]
-
The ‘introspect’ callback with the editor
Internals
Declaration
Swift
private(set) var introspect: IntrospectCallback?
-
Make a
coordinator
for theNSViewRepresentable
Declaration
Swift
func makeCoordinator() -> Coordinator
Return Value
A
coordinator
-
Make the
View
Declaration
Swift
func makeNSView(context: Context) -> Wrapper
Parameters
context
The context
Return Value
The wrapped editor
-
Update the
View
Declaration
Swift
func updateNSView(_ wrapper: Wrapper, context: Context)
Parameters
wrapper
The wrapped editor
context
The context
-
Highlight the text in the editor
Declaration
Swift
func highlightText(textView: NSTextView, range: NSRange? = nil)
Parameters
textView
The current
TextView
range
The range to highlight
-
The coordinator for the
See moreChordProEditor
Declaration
Swift
class Coordinator: NSObject, NSTextViewDelegate
-
Share internal editor stuff with the SwiftUI
See moreView
Declaration
Swift
struct Internals: Sendable
-
The layout manager for the editor
See moreDeclaration
Swift
class LayoutManager: NSLayoutManager, NSLayoutManagerDelegate
-
The line numbers view for the editor
See moreDeclaration
Swift
class LineNumbersView: NSRulerView
-
The text view for the editor
See moreDeclaration
Swift
class TextView: NSTextView
-
Declaration
Swift
class Wrapper: NSView, ChordProEditorDelegate
-
Introspect for the editor
Declaration
Swift
func introspect(callback: @escaping IntrospectCallback) -> Self
Parameters
callback
The callback function
Return Value
Itself