SwiftUI TextEditor formatting

Is it possible to have syntax based formatting in the new TextEditor from Xcode 12?

Background: I need to implement a text editor that comprehends subset of Markdown.

As of SwiftUI 2, I don't think so. I believe you need to wrap an NSTextView or UITextView with this functionality. Doing this for UIKit is very straightforward (just use UIViewRepresentable), but on the Mac it's more complicated because NSTextView isn't a scroll view subclass like UITextView is. Here's a gist I found that shows what you need to do on macOS: https://gist.github.com/unnamedd/6e8c3fbc806b8deb60fa65d6b9affab0
SwiftUI TextEditor formatting
 
 
Q