ChordProEditor
struct ChordProEditor: NSViewRepresentable
SwiftUI NSViewRepresentable
for the ChordPro editor
-
The text of the ChordPro file
Declaration
Swift
var text: String
-
Init the ChordProEditor
Declaration
Swift
init(text: Binding<String>, connector: Connector)
Parameters
text
The text of the
ChordProDocument
connector
The
Connector
class for the editor -
Make a
coordinator
for theSWIFTViewRepresentable
Declaration
Swift
func makeCoordinator() -> Coordinator
Return Value
A
coordinator
-
Declaration
Swift
func makeNSView(context: Context) -> Wrapper
-
Wait for next cycle and set the textview as first responder
Declaration
Swift
func updateNSView(_ nsView: Wrapper, context: Context)
-
The observable
See moreConnector
class for the editorDeclaration
Swift
final class Connector: Sendable
-
The coordinator for the
See moreChordProEditor
Declaration
Swift
class Coordinator: NSObject, NSTextViewDelegate
-
The line numbers view for the editor
See moreDeclaration
Swift
public class LineNumbersView: NSRulerView
-
The current state of selection in the editor
See moreDeclaration
Swift
enum SelectionState: String
-
Settings for the editor
See moreDeclaration
Swift
struct Settings: Equatable, Codable, Sendable
-
The lineheight multiplier for the editpr text
Declaration
Swift
static let lineHeightMultiple: Double = 1.2
-
The style of a paragraph in the editor
Declaration
Swift
static let paragraphStyle: NSParagraphStyle = { let style = NSMutableParagraphStyle() style.lineHeightMultiple = ChordProEditor.lineHeightMultiple style.headIndent = 10 return style }()
-
The style of a number in the ruler
Declaration
Swift
static var rulerNumberStyle: SWIFTStringAttribute
-
The style of a symbol in the ruler
Declaration
Swift
static var rulerSymbolStyle: SWIFTStringAttribute
-
The foreground of the highlighted line in the editor
Declaration
Swift
static let highlightedForegroundColor: NSColor = .textColor.withAlphaComponent(0.3)
-
The background of the highlighted line in the editor
Declaration
Swift
static let highlightedBackgroundColor: NSColor = .textColor.withAlphaComponent(0.03)
-
The text view for the editor
See moreDeclaration
Swift
public class TextView: NSTextView
-
Declaration
Swift
public class Wrapper: NSView, NSTextLayoutManagerDelegate, ChordProEditorDelegate