简体   繁体   中英

SwiftUI - How to apply markdown to TextEditor?

With iOS 15 and Swift 5, I can add markdown to text, eg

Text("Regular")
Text("*Italics*")
Text("**Bold**")
Text("~Strikethrough~")
Text("`Code`")
Text("[Link](https://apple.com)")
Text("***[They](https://apple.com) ~are~ `combinable`***")

But is it possible to somehow apply this to TextEditor as well? Can a user highlight some written text and apply specific markdown format to that text?

TextEditor(text: $notes) // how can $notes accept markdown here?

Maybe do this:

Text(content).lineLimit(nil)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM