Show line numbers in macOS SwiftUI TextEditor

Viewed 673

I'm creating a document-based application for macOS using SwiftUI.

Is there a built-in styling method for showing a TextEditor's line numbers?

struct ContentView: View {
    @Binding var document: AppDocument

    var body: some View {
        TextEditor(text: $document.text) // I removed a few irrelevant options.
            .disableAutocorrection(true)
            .font(.system(size: 12, design: .monospaced))
    }
}

The current view is the following: View

1 Answers
Related